pub fn collect_headings<'a>(
root: Node<'a>,
prefix: Option<&str>,
) -> Vec<Heading>Expand description
Walks the AST and returns one Heading per heading node, in
document order.
prefix mirrors MarkdownOptions::header_ids:
NoneorSome("")→ bare slug ("introduction").Some(p)→format!("{p}{slug}")("user-content-introduction").
Uses comrak’s own Anchorizer so dedup behaviour (-1, -2
suffixes for repeated headings) matches the rendered HTML.