jxxcarlson/elm-markdown/10.1.0

Markdown.Render

For simple applications, the function toHtml will be enough. The other functions are mostly for building apps, e.g., editors, in which the source text changes a lot. The best guide to using the code are the examples. See the folder examples and editors.

Types

= Simple (Html MarkdownMsg)
| Composite DocumentParts

the type of output

= IDClicked String

Use Html MarkdownMsg so that user clicks on elements in the rendered text can be detected.

type alias DocumentParts =
{ title : Html MarkdownMsg
, toc : Html MarkdownMsg
, document : Html MarkdownMsg
}

The parts of a composite document

Rendering

toHtml : MarkdownOption -> String -> Html MarkdownMsg

Render source test given an a Markdown flavor

toHtml_ : MarkdownOption -> String -> List (Html MarkdownMsg)

Like toHtml, but produces a List (Html MarkdownMsg) value.

withOptions : MarkdownOption -> OutputOption -> Id -> Int -> String -> MarkdownOutput

Render content with Markdown and output options, given a selected Id and a version

Rendering from AST

fromAST : Id -> Tree MDBlockWithId -> Html MarkdownMsg

Render to Html from a parse tree

Render from an AST

Getters

Get parts of a document from a MarkdownOutput value.

document content

Table of contents

Utility

Count the number of display math element blocks in the parse tree