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
//! Internal library for the `math-core` crate for rendering MathML.
//!
//! This library allows you to construct an AST representing MathML and then render it to a string.
//!
//! # Example
//!
//! ```rust
//! use rustc_hash::FxHashMap;
//!
//! use math_core_renderer_internal::ast::{CssClassNames, Emitter, Indentation, Node};
//! use math_core_renderer_internal::symbol;
//! use math_core_renderer_internal::attribute::{MathSpacing, LetterAttr, OpAttrs, RowAttrs};
//!
//! let ast = Node::Row {
//! nodes: &[
//! &Node::Under {
//! target: &Node::Operator {
//! op: symbol::N_ARY_SUMMATION.as_op(),
//! attrs: OpAttrs::empty(),
//! left: Some(MathSpacing::Zero),
//! right: None,
//! size: None,
//! },
//! symbol: &Node::IdentifierChar('i'.into(), LetterAttr::Default),
//! },
//! &Node::IdentifierChar('i'.into(), LetterAttr::Default),
//! ],
//! attrs: RowAttrs::DEFAULT,
//! };
//!
//! let label_map = FxHashMap::default();
//! let css_classes = CssClassNames::default();
//! let mut emitter = Emitter::new(String::new(), &label_map, &css_classes, Indentation::default());
//! emitter.emit(&ast, 0).unwrap();
//! let output = emitter.into_string();
//! assert_eq!(
//! output,
//! "<mrow><munder><mo lspace=\"0\">∑</mo><mi>i</mi></munder><mi>i</mi></mrow>"
//! );
//! ```