diff --git a/packages/viewer/src/mathml.ts b/packages/viewer/src/mathml.ts index a9195409d..8cf0a0693 100644 --- a/packages/viewer/src/mathml.ts +++ b/packages/viewer/src/mathml.ts @@ -77,7 +77,15 @@ export async function renderMathML(properties: Properties, root: HTMLElement): P decodeSafeMathML(root, properties.ignored_containers); - for (const mathElement of [...root.getElementsByTagName("math")]) { + // Fixed to get all possible math elements, including namespaced ones. + const allMathElements = [ + ...root.getElementsByTagName("math"), // Standard + ...root.getElementsByTagNameNS("*", "math"), // Any valid namespaced math + ...root.querySelectorAll("m\\:math"), // CSS: (literal colon) + ...root.querySelectorAll("mml\\:math"), // CSS: (literal colon) + ]; + + for (const mathElement of allMathElements) { const mml = serializeHtmlToXml(mathElement.outerHTML); try { let imgSource;