Skip to main content

math_core_renderer_internal/
lib.rs

1//! Internal library for the `math-core` crate for rendering MathML.
2//!
3//! This library allows you to construct an AST representing MathML and then render it to a string.
4//!
5//! # Example
6//!
7//! ```rust
8//! use rustc_hash::FxHashMap;
9//!
10//! use math_core_renderer_internal::ast::{CssClassNames, Emitter, Indentation, Node};
11//! use math_core_renderer_internal::symbol;
12//! use math_core_renderer_internal::attribute::{MathSpacing, LetterAttr, OpAttrs, RowAttrs};
13//!
14//! let ast = Node::Row {
15//!     nodes: &[
16//!         &Node::Under {
17//!             target: &Node::Operator {
18//!                 op: symbol::N_ARY_SUMMATION.as_op(),
19//!                 attrs: OpAttrs::empty(),
20//!                 left: Some(MathSpacing::Zero),
21//!                 right: None,
22//!                 size: None,
23//!             },
24//!             symbol: &Node::IdentifierChar('i'.into(), LetterAttr::Default),
25//!         },
26//!         &Node::IdentifierChar('i'.into(), LetterAttr::Default),
27//!      ],
28//!      attrs: RowAttrs::DEFAULT,
29//! };
30//!
31//! let label_map = FxHashMap::default();
32//! let css_classes = CssClassNames::default();
33//! let mut emitter = Emitter::new(String::new(), &label_map, &css_classes, Indentation::default());
34//! emitter.emit(&ast, 0).unwrap();
35//! let output = emitter.into_string();
36//! assert_eq!(
37//!     output,
38//!     "<mrow><munder><mo lspace=\"0\">∑</mo><mi>i</mi></munder><mi>i</mi></mrow>"
39//! );
40//! ```
41pub mod arena;
42pub mod ast;
43pub mod attribute;
44mod escaping;
45pub mod fmt;
46mod itoa;
47pub mod length;
48pub mod super_char;
49pub mod symbol;
50pub mod table;