arowM/elm-markdown-ast/1.0.6

MarkdownAst

This module provides abstruct syntax tree for markdown.

Structure

type Section
= Section
{ title : String
, body : List BlockElement
, children : List Section
}

Represents markdown section.

# Title for Root Section


Paragraph text in root section body.


Another paragraph text in root section body.


* List item in root section body
* Another list item in root section body


## Title for Child Section


Paragraph text in child section body.


```json
{
  "message": "Code block in child section body."
}
```


## Title for Another Child Section


Paragraph text in another child section body.


1. Ordered list item in another child section body
1. Another ordered list item in another child section body
= ParagraphBlock (List InlineElement)
| ListBlock
{ ordered : Bool
, items : List ListItem
}
| CodeBlock String
| QuoteBlock (List BlockElement)
= PlainText String
| Link
{ href : String
, text : String
, title : Maybe String
}
| Image
{ src : String
, alt : String
, title : Maybe String
}
| InlineCode String
| Emphasis String
| StrongEmphasis String
| Strikethrough String
| LineBreak
type alias ListItem =
{ content : List InlineElement
, children : List BlockElement
}

Represents an item in the ListBlock.

* First `ListItem` content for this unordered `ListBlock`
    Child element for the first `ListItem`.

    1. This `ListItem` is in the child `ListBlock` for the First `ListItem` content.
    1. This `ListItem` is also in the child `ListBlock` for the First `ListItem` content.

* Second `ListItem` content for this unordered `ListBlock`

Render

render : Section -> String

Render Section as markdown text.

preview : Section -> Html msg

Preview markdown content as an HTML page.