Skip to content

[FHL] Preserve MathML during model conversion - #3466

Draft
Jiuqing Song (JiuqingSong) wants to merge 1 commit into
masterfrom
fhl-preserve-mathml
Draft

Jiuqing Song (JiuqingSong) wants to merge 1 commit into
masterfrom
fhl-preserve-mathml

Conversation

@JiuqingSong

Copy link
Copy Markdown
Collaborator

Summary

Treat <math> elements as atomic entities during DOM-to-Content-Model conversion so their nested MathML remains intact. Extend HTML sanitization to allow MathML elements and preserve their MathML namespace instead of replacing them with HTML fallback spans.

How to test

  1. Run yarn test:fast --testPathPattern="(elementProcessorTest|sanitizeElementTest)".
  2. Convert content containing <math><mrow><mi>x</mi><mo>+</mo><mn>1</mn></mrow></math> to a Content Model and confirm the formula is represented by one entity whose wrapper retains the nested MathML.
  3. Sanitize nested MathML and confirm the element names and http://www.w3.org/1998/Math/MathML namespace are preserved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e6f62b24-df3c-4924-a015-274313ad5727
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://microsoft.github.io/roosterjs/pr-preview/pr-3466/

Built to branch gh-pages at 2026-09-15 20:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant