pub fn parse_with_config(markdown: &str, config: &ParseConfig) -> DocumentExpand description
Parse markdown into a typed Document.
This is the AST entry point. The input is post-resolve markdown (the
upstream resolve pipeline has already rewritten wikilinks into standard
markdown links with moss-resolved: prefixes).
Two-stage parse:
- [
extract_shortcodes] pre-scans for:::nameblocks, replacing each with a sentinel HTML comment. - Pulldown-cmark parses the substituted markdown into events; each
sentinel comes back as a
Block::Otherraw HTML. - A final pass walks the AST and substitutes
Block::Othersentinel payloads with the corresponding typedBlock::Shortcode.
When config.emit_source_lines is true, the parser walks events via
into_offset_iter() so each top-level block carries the byte offset
of its first event; a [LineLookup] converts the offset to a 1-based
line number stored in BlockMeta::source_line.