Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Parser syntax-error channel.

Markdown itself is never syntactically invalid — every byte sequence is some lossless CST — so the block/inline parsers emit no diagnostics. Embedded sublanguages are different: hashpipe and frontmatter YAML can be malformed, and (later) LaTeX math or raw HTML may be validated too. When the parser validates such a region it already knows the verdict and offset; rather than discard it and force a downstream re-parse, it records a host-ranged SyntaxError here, mirroring rust-analyzer’s Parse { green, errors }.

The CST is unchanged — invalid YAML still becomes opaque tokens. This channel is purely the diagnostic the parser already computed, surfaced instead of thrown away. It is empty for pure Markdown.

Structs§

Diagnostics
Interior-mutable sink the single-pass parser pushes into while building.
SyntaxError
A syntax error the parser found in an embedded sublanguage, with a host-aligned byte range (ready to turn into a diagnostic without any offset remapping).

Enums§

SyntaxErrorSource
Which sublanguage validation produced a SyntaxError. Lets downstream consumers (the linter) map to the right diagnostic code without the parser knowing linter codes.