Expand description
Math-region grammar.
TeX-style math (\[ … \], \( … \), $$ … $$, $ … $,
\begin{env} … \end{env}) is opaque to CommonMark: pulldown
tokenises the bytes inside as plain prose, so _ becomes
emphasis, [ becomes a link candidate, * becomes a delimiter
run. Without an overlay the formatter’s round-trip drifts.
This module is the structural recogniser. scan::scan_math_regions
consumes source plus the IR’s inline / block atoms and produces:
MathRegionvalues consumed by the format pipeline. The region carries aspan::MathSpantag with delimiter and body data.span::MathErrorvalues surfaced by themath/unbalanced-delim,math/unbalanced-env, andmath/unbalanced-braceslint rules.
Stack-based tracking enforces \begin / \end balance with
nesting on the same environment name; the four primitive
delimiter pairs match greedily on first close.
Re-exports§
pub use scan::MathConfig;pub use scan::scan_math_regions;pub use span::AnyDelim;pub use span::DisplayDelim;pub use span::InlineDelim;pub use span::MathBody;pub use span::MathError;pub use span::MathSpan;
Modules§
- env
- LaTeX environment classification.
- normalise
- Pure string-to-string math-body normalisations.
- render
- Delimiter rewrite helper for dollar-shaped renderer output.
- scan
- Structural math recogniser.
- span
- Delimiter classification, recogniser error types, and per-region tagged spans.
Structs§
- Math
Region - One recognised math region in source order.