Parses a non-standard Markdown flavor to an abstract syntax tree by defining its parsing expression grammar (PEG) with pest.
The main function exported from the crate, parse_document
, accepts a &str
and on success returns a Document
with the same lifetime as the input. From there, you can traverse the tree starting at the root using its iter()
or into_iter()
methods, which provide a stream of Blocks
. Inline styles are defined by the Text
enum and represent the leaf nodes of the tree.
pest
lacks support for streaming, this crate also can't read a document from a stream.The parser's grammar deviates from CommonMark v0.30 in the following ways:
Markdown.pl
.As an example, this file's syntax follows the rules implemented by the parser.