cmark-0.4.1: Fast, accurate CommonMark (Markdown) parser and renderer

Safe Haskell | None
Language | Haskell2010

CMark

Synopsis

- commonmarkToHtml :: [CMarkOption] -> Text -> Text
- commonmarkToXml :: [CMarkOption] -> Text -> Text
- commonmarkToMan :: [CMarkOption] -> Maybe Int -> Text -> Text
- commonmarkToLaTeX :: [CMarkOption] -> Maybe Int -> Text -> Text
- commonmarkToNode :: [CMarkOption] -> Text -> Node
- nodeToHtml :: [CMarkOption] -> Node -> Text
- nodeToXml :: [CMarkOption] -> Node -> Text
- nodeToMan :: [CMarkOption] -> Maybe Int -> Node -> Text
- nodeToLaTeX :: [CMarkOption] -> Maybe Int -> Node -> Text
- nodeToCommonmark :: [CMarkOption] -> Maybe Int -> Node -> Text
- optSourcePos :: CMarkOption
- optNormalize :: CMarkOption
- optHardBreaks :: CMarkOption
- optSmart :: CMarkOption
- optSafe :: CMarkOption
- data Node = Node (Maybe PosInfo) NodeType [Node]
- data NodeType
  - = DOCUMENT
  - | HRULE
  - | PARAGRAPH
  - | BLOCK_QUOTE
  - | HTML Text
  - | CODE_BLOCK Info Text
  - | HEADER Level
  - | LIST ListAttributes
  - | ITEM
  - | TEXT Text
  - | SOFTBREAK
  - | LINEBREAK
  - | INLINE_HTML Text
  - | CODE Text
  - | EMPH
  - | STRONG
  - | LINK Url Title
  - | IMAGE Url Title
- data PosInfo = PosInfo {
  - startLine :: Int
  - startColumn :: Int
  - endLine :: Int
  - endColumn :: Int
  }
- data DelimType
  - = PERIOD_DELIM
  - | PAREN_DELIM
- data ListType
  - = BULLET_LIST
  - | ORDERED_LIST
- data ListAttributes = ListAttributes {
  - listType :: ListType
  - listTight :: Bool
  - listStart :: Int
  - listDelim :: DelimType
  }
- type Url = Text
- type Title = Text
- type Level = Int
- type Info = Text
- data CMarkOption

# Documentation

commonmarkToHtml :: [CMarkOption] -> Text -> Text

Convert CommonMark formatted text to Html, using cmark's built-in renderer.

commonmarkToXml :: [CMarkOption] -> Text -> Text

Convert CommonMark formatted text to CommonMark XML, using cmark's built-in renderer.

commonmarkToMan :: [CMarkOption] -> Maybe Int -> Text -> Text

Convert CommonMark formatted text to groff man, using cmark's built-in renderer.

commonmarkToLaTeX :: [CMarkOption] -> Maybe Int -> Text -> Text

Convert CommonMark formatted text to latex, using cmark's built-in renderer.

commonmarkToNode :: [CMarkOption] -> Text -> Node

Convert CommonMark formatted text to a structured `Node` tree, which can be transformed or rendered using Haskell code.

nodeToHtml :: [CMarkOption] -> Node -> Text

nodeToXml :: [CMarkOption] -> Node -> Text

nodeToMan :: [CMarkOption] -> Maybe Int -> Node -> Text

nodeToLaTeX :: [CMarkOption] -> Maybe Int -> Node -> Text

nodeToCommonmark :: [CMarkOption] -> Maybe Int -> Node -> Text

optSourcePos :: CMarkOption

Include a `data-sourcepos` attribute on block elements.

optNormalize :: CMarkOption

Normalize the document by consolidating adjacent text nodes.

optHardBreaks :: CMarkOption

Render `softbreak` elements as hard line breaks.

optSmart :: CMarkOption

Convert straight quotes to curly, `---` to em-dash, `--` to en-dash.

optSafe :: CMarkOption

Suppress rendering of raw HTML and potentially dangerous URLs in links and images.

data Node

Constructors

Node (Maybe PosInfo) NodeType [Node] |

Instances

Eq Node |
Data Node |
Ord Node |
Read Node |
Show Node |
Generic Node |
type Rep Node |

data NodeType

Constructors

DOCUMENT |
HRULE |
PARAGRAPH |
BLOCK_QUOTE |
HTML Text |
CODE_BLOCK Info Text |
HEADER Level |
LIST ListAttributes |
ITEM |
TEXT Text |
SOFTBREAK |
LINEBREAK |
INLINE_HTML Text |
CODE Text |
EMPH |
STRONG |
LINK Url Title |
IMAGE Url Title |

Instances

Eq NodeType |
Data NodeType |
Ord NodeType |
Read NodeType |
Show NodeType |
Generic NodeType |
type Rep NodeType |

data PosInfo

Constructors

PosInfo |
Fields startLine :: Int startColumn :: Int endLine :: Int endColumn :: Int

Instances

Eq PosInfo |
Data PosInfo |
Ord PosInfo |
Read PosInfo |
Show PosInfo |
Generic PosInfo |
type Rep PosInfo |

data DelimType

Constructors

PERIOD_DELIM |
PAREN_DELIM |

Instances

Eq DelimType |
Data DelimType |
Ord DelimType |
Read DelimType |
Show DelimType |
Generic DelimType |
type Rep DelimType |

data ListType

Constructors

BULLET_LIST |
ORDERED_LIST |

Instances

Eq ListType |
Data ListType |
Ord ListType |
Read ListType |
Show ListType |
Generic ListType |
type Rep ListType |

data ListAttributes

Constructors

ListAttributes |
Fields listType :: ListType listTight :: Bool listStart :: Int listDelim :: DelimType

Instances

Eq ListAttributes |
Data ListAttributes |
Ord ListAttributes |
Read ListAttributes |
Show ListAttributes |
Generic ListAttributes |
type Rep ListAttributes |

type Url = Text

type Title = Text

type Level = Int

type Info = Text

data CMarkOption