scanDocument

Scans a markdown document and returns a flat list of Spans with absolute document offsets for syntax highlighting.

Uses :markdown's pipeline:

  1. Parse document to get link ref defs

  2. Scan text into lexemes (with SourceRange)

  3. Walk lines emitting block-level AND inline-level spans