Skip to main content

parse

Function parse 

Source
pub fn parse(source: &str) -> Vec<RichEvent>
Expand description

Parse source as marquee-flavoured markdown and produce a RichEvent stream ready for layout.

Infallible: every input is a document. See the module docs for how malformed spans and fences degrade.

The parser runs in two passes:

  1. Div pre-pass — scan lines for :::class open fences and bare ::: close fences. Split the source into a sequence of text chunks separated by synthetic DivStart / DivEnd events. Each text chunk is a self-contained markdown block; a paragraph or list cannot span a div boundary.
  2. Chunk pass — feed each text chunk through pulldown-cmark (with strikethrough, sup, sub, and math extensions enabled) and layer on the {selector body} inline-span post-pass.