Skip to Content

@stesura/core/omml

OMML (Word equations) → LaTeX. A separate entry point because it pulls in xpath and mathml-to-latex (~560 KB unminified with mathml-to-latex’s @xmldom/xmldom, ~300 KB minified): the DOCX importer imports it directly, while the Word paste handler (wordPasteHandlerPlugin) lazy-loads it so it stays out of the editor’s initial bundle.

Functions

ommlToLatex

Convert an OMML element (m:oMath / m:oMathPara) into LaTeX: OMML → MathML (omml2mathml, a JS port of Microsoft’s OMML2MML.XSL, vendored — see ./vendor/README.md for why) → LaTeX (mathml-to-latex).

The element must come from a NAMESPACE-AWARE parse (application/xml): the walker matches on namespaceURI, which the text/html parser never sets. Requires a DOM (browser, or jsdom in tests).

Returns null when conversion fails; callers should fall back to the element’s text content so no content is silently dropped.

Parameters:
NameTypeDefault
ommlElement
Returns:
string | null
Last updated on