Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/viewer/src/mathml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <math>
...root.getElementsByTagNameNS("*", "math"), // Any valid namespaced math
...root.querySelectorAll("m\\:math"), // CSS: <m:math> (literal colon)
...root.querySelectorAll("mml\\:math"), // CSS: <mml:math> (literal colon)
];

for (const mathElement of allMathElements) {
const mml = serializeHtmlToXml(mathElement.outerHTML);
try {
let imgSource;
Expand Down
Loading