The purpose of this module is to parse a Document,
that is, a string, into an abstract syntax tree (AST)
which can then be further transformed or passed on
to a rendering function. The AST is a rose tree
of MDBlockWithId — short for "Markdown Blocks."
See the documentation at the head of module Markdown.ElmWithId for
the rationale for this module.
An MDBlock (Markdown block) carries
- the type of the block
- its level
- its unparsed contentAn MBlockWithId is like na MDBlock, except that it has an
Id : (Int, Int)which should be thought of as
( version, id )where the id is unique to each block.
The type of a parsed Block
Check for equality of
- blockType
- level
- contentignoring the id.
Project an MDBlockWithId to an MDBlock by omitting its id
Used to generate Ids of Html elements and to implement differential rendering. The first Int is a version number, incremented after each edit. The second is a an integer representing position in a traversal of the tree of blocks obtained by parsing the text.
Return a string value of and Id
Return the id of a block
Return a string representing the content of a block
if it is of type T. Otherwise, return the empty string.
A string representation of an MDBlockTree. Useful for verifying the validity of the AST.
Parse a string using a Markdown flavor option, returning the AST. Example: