Skip to main content

parse_djot

Function parse_djot 

Source
pub fn parse_djot(djot: &str, options: &DjotImportOptions) -> Vec<ParsedElement>
Expand description

Parse djot source into the shared ParsedElement intermediate, mirroring parse_markdown. Uses the jotdown pull parser.

Constructs the document model cannot represent are dropped, and their text content is discarded so it never leaks into the document: footnotes, math, fenced divs, raw blocks/inline, thematic breaks, description lists, captions, symbols, link-reference definitions, and highlight/mark. Inline images keep their alt text as plain text (the image itself is not modelled), matching the Markdown importer. Smart-punctuation events are normalised to their canonical Unicode characters so the model→djot→model round-trip is a fixpoint.

Standalone paragraphs and headings additionally carry the optional block-style attributes selected by options — paragraph alignment, line height, text direction, non-breakable lines and background color — read from djot {key=value} block attributes (see DjotImportOptions). List items, code blocks and table cells normalise their block styling away.

Known model limitations (normalised, not preserved on round-trip): ordered-list start number, table column alignment, and list tight/loose.