Expand description
Node-tree → MathML Core serializer.
Deterministic: attribute order is fixed per element, every element has an explicit close tag (no self-closing form), and text/attr values are XML escaped. The walk never panics; a hostile or fragment tree still yields a well-formed fragment.
Functions§
- mathml_
well_ formed - Std-only well-formedness check: balanced tags, quoted attributes, escaped text. Accepts the serializer’s output contract (no self-closing tags).
- to_
mathml - Serialize
nodeas a complete<math>…</math>fragment. - to_
mathml_ element - Serialize
nodeas a MathML element (no outer<math>wrapper). - to_
mathml_ with_ capacity to_mathmlwith a TeX-source-length hint used only to presize the output buffer (MATHML_CAPACITY_FLOOR + tex_len * MATHML_BYTES_PER_TEX_BYTEbytes, so the serializer does not walk the realloc-doubling chain for typical formulas). The emitted bytes are identical toto_mathmlfor every(node, display, tex_len)— buffer capacity is never observable in the output.