1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Math display parser - converts grammar output to DisplayMath AST node
//!
//! Parses display math delimited by `$$...$$` using KaTeX.
use ;
use cratedisplay_math;
use crate;
use IResult;
/// Parse a display math expression `$$...$$` to a DisplayMath AST node.
///
/// # Example
/// ```
/// use marco_core::parser::inlines::math_display_parser::parse_display_math;
/// use marco_core::parser::shared::GrammarSpan;
/// use marco_core::NodeKind;
///
/// let input = GrammarSpan::new("$$\\int x^2 dx$$ text");
/// let (_rest, node) = parse_display_math(input).unwrap();
/// assert!(matches!(node.kind, NodeKind::DisplayMath { content } if content == "\\int x^2 dx"));
/// ```