cmark-0.5.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
  - | THEMATIC_BREAK
  - | PARAGRAPH
  - | BLOCK_QUOTE
  - | HTML_BLOCK Text
  - | CUSTOM_BLOCK OnEnter OnExit
  - | CODE_BLOCK Info Text
  - | HEADING Level
  - | LIST ListAttributes
  - | ITEM
  - | TEXT Text
  - | SOFTBREAK
  - | LINEBREAK
  - | HTML_INLINE Text
  - | CUSTOM_INLINE OnEnter OnExit
  - | 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 Source

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

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

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

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

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

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

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

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

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

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

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

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

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

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

optSourcePos :: CMarkOption Source

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

optNormalize :: CMarkOption Source

Normalize the document by consolidating adjacent text nodes.

optHardBreaks :: CMarkOption Source

Render `softbreak` elements as hard line breaks.

optSmart :: CMarkOption Source

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

optSafe :: CMarkOption Source

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

data Node Source

Constructors

Node (Maybe PosInfo) NodeType [Node] |

Instances

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

data NodeType Source

Constructors

DOCUMENT |
THEMATIC_BREAK |
PARAGRAPH |
BLOCK_QUOTE |
HTML_BLOCK Text |
CUSTOM_BLOCK OnEnter OnExit |
CODE_BLOCK Info Text |
HEADING Level |
LIST ListAttributes |
ITEM |
TEXT Text |
SOFTBREAK |
LINEBREAK |
HTML_INLINE Text |
CUSTOM_INLINE OnEnter OnExit |
CODE Text |
EMPH |
STRONG |
LINK Url Title |
IMAGE Url Title |

Instances

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

data PosInfo Source

Constructors

PosInfo |

Fields

startLine :: Int
startColumn :: Int
endLine :: Int
endColumn :: Int

Instances

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

data DelimType Source

Constructors

PERIOD_DELIM |
PAREN_DELIM |

Instances

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

data ListType Source

Constructors

BULLET_LIST |
ORDERED_LIST |

Instances

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

data ListAttributes Source

Constructors

ListAttributes |

Fields

listType :: ListType
listTight :: Bool
listStart :: Int
listDelim :: DelimType

Instances

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

type Url = Text Source

type Title = Text Source

type Level = Int Source

type Info = Text Source

data CMarkOption Source