Skip to content

fix(docx): keep raw LaTeX in math spans instead of Markdown escapes - #2760

Open
Yunare Maia (yunaremaia) wants to merge 1 commit into
microsoft:mainfrom
yunaremaia:fix/docx-math-escapes
Open

Yunare Maia (yunaremaia) wants to merge 1 commit into
microsoft:mainfrom
yunaremaia:fix/docx-math-escapes

Conversation

@yunaremaia

Copy link
Copy Markdown

Closes #2744. oMath equations are injected as $...$ text runs, so the HTML-to-Markdown step escapes LaTeX _ and * (output: $\sum\_...$). _unescape_math_spans restores the raw LaTeX inside math spans only; typed text elsewhere keeps its escapes. TDD: new test_docx_math_no_markdown_escapes built from the issue's reproducer failed before, passes after; full tests/test_docx.py 102 passed. Implemented and reviewed by hand.

oMath equations are injected as $...$ text, so the HTML-to-Markdown
step escapes LaTeX _ and * as \_ and \*, breaking the math. Unescape
those two sequences inside math spans only; typed text keeps escapes.

Closes microsoft#2744.
@yunaremaia

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

DOCX: equations get \_ and \* in their LaTeX ($\sum\_{i=1}^{n}x\_{i}$)

1 participant