Expand description
Math parsing for both inline and display math.
This module handles all math-related parsing:
- Inline math:
$...$,\(...\),\\(...\\)- single line only - Display math:
$$...$$,\[...\],\\[...\\]- can span multiple lines
Display math can appear both inline (within paragraphs) and as block-level elements.
The parsing functions return Option<(usize, &str)> tuples containing the length
consumed and the math content, allowing calling contexts to emit appropriate nodes.
Functions§
- emit_
display_ math - Emit a display math node to the builder (when occurring inline in paragraph).
- emit_
display_ math_ environment - Emit a display math environment node using raw \begin…\end… markers.
- emit_
double_ backslash_ display_ math - Emit a double backslash display math node: \[…\]
- emit_
double_ backslash_ inline_ math - Emit a double backslash inline math node: \(…\)
- emit_
gfm_ inline_ math - Emit a GFM inline math node: $
...$ - emit_
inline_ math - Emit an inline math node to the builder.
- emit_
single_ backslash_ display_ math - Emit a single backslash display math node: […]
- emit_
single_ backslash_ inline_ math - Emit a single backslash inline math node: (…)
- try_
parse_ display_ math - Try to parse display math ($$…$$) starting at the current position. Returns the number of characters consumed and the math content if successful. Display math can span multiple lines in inline contexts.
- try_
parse_ double_ backslash_ display_ math - Try to parse double backslash display math: \[…\] Extension: tex_math_double_backslash
- try_
parse_ double_ backslash_ inline_ math - Try to parse double backslash inline math: \(…\) Extension: tex_math_double_backslash
- try_
parse_ gfm_ inline_ math - Try to parse GFM inline math: $
...$ Extension: tex_math_gfm - try_
parse_ inline_ math - Try to parse an inline math span starting at the current position. Returns the number of characters consumed if successful, or None if not inline math.
- try_
parse_ math_ environment - Try to parse a LaTeX math environment (\begin{equation}…\end{equation}) as display math. Returns (total_len, begin_marker, content, end_marker).
- try_
parse_ single_ backslash_ display_ math - Try to parse single backslash display math: […] Extension: tex_math_single_backslash
- try_
parse_ single_ backslash_ inline_ math - Try to parse single backslash inline math: (…) Extension: tex_math_single_backslash