| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Comark
Description
It mostly contains reexports from the following modules:
- parse :: [ParserOption] -> Text -> Doc Text
- data ParserOption :: *
- render :: Doc Text -> Text
- newtype Doc t :: * -> * = Doc (Blocks t)
- type Blocks t = Seq (Block t)
- data Block t :: * -> *
- data HeadingLevel :: *
- data ListType :: *
- data Delimiter :: *
- data BulletMarker :: *
- type Inlines t = Seq (Inline t)
- data Inline t :: * -> *
Parser
parse :: [ParserOption] -> Text -> Doc Text #
Parses Commonmark document. Any sequence of characters is a valid Commonmark document.
At the moment no sanitizations are performed besides the ones defined in the spec.
data ParserOption :: * #
Constructors
| Normalize | Consolidate adjacent text nodes. |
| LinkReferences (Text -> Maybe (Text, Maybe Text)) | Predefine link reference defenitions. References are represented with a mapping from a link text to a pair of a link destination and an optional link title. During parsing the link references defined in a document would be collected into additional mapping. When link references are being mapping defined in options takes precedence over mapping found in the document. TODO: Examples |
HTML Rendererer
AST types
Document
A Document
Blocks
Block elements
Constructors
| ThematicBreak | Thematic break |
| Heading HeadingLevel (Inlines t) | Heading: level, sequnce of inlines that define content |
| CodeBlock (Maybe t) t | Block of code: info string, literal content |
| HtmlBlock t | Raw HTML Block |
| Para (Inlines t) | Paragraph (a grouped sequence of inlines) |
| Quote (Blocks t) | Block Quote (a quoted sequence of blocks) |
| List ListType Bool (Seq (Blocks t)) | List: Type of the list, tightness, a sequnce of blocks (list item) |
data HeadingLevel :: * #
Constructors
| Ordered Delimiter Int | |
| Bullet BulletMarker |
data BulletMarker :: * #
Inlines
Inline elements
Constructors
| Str t | Text (string) |
| Code t | Inline code |
| Emph (Inlines t) | Emphasized text (a sequence of inlines) |
| Strong (Inlines t) | Strongly emphasized text (a sequence of inlines) |
| Link (Inlines t) t (Maybe t) | Hyperlink: visible link text (sequence of inlines), destination, title |
| Image (Inlines t) t (Maybe t) | Image hyperlink: image description, destination, title |
| RawHtml t | Inline Raw HTML tag |
| SoftBreak | A regular linebreak. A conforming renderer may render a soft line break in HTML either as line break or as a space. |
| HardBreak | A line break that is marked as hard (either with spaces or
backslash, see the spec for details). In html it would be rendered
as |