Repository navigation
fix(docx): preserve native OMML equation structure - #2163
Open
HenryZhu123 wants to merge 2 commits into
Open
HenryZhu123 wants to merge 2 commits into
HenryZhu123 wants to merge 2 commits into
Conversation
2 tasks done
habibullah781
approved these changes
Oct 29, 2026
HenryZhu123
force-pushed
the
fix/2144-docx-omml-equations
branch
from
October 30, 2026 02:50
fd57c90 to
47e39c4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Native Word equations are stored as structured Office Math (OMML), but the
current DOCX walker collects only their text leaves. This causes expressions
such as
1/2 + 1/3,2^3, andsqrt(9)to be extracted as12 + 13,23,and
9.This change makes the shared DOCX extraction path namespace-aware and
recursively renders common OMML structures into unambiguous, model-readable
text:
a/ba^b,a_b, anda_b^csqrt(x)androot(n, x)x^2/sqrt(y)Unsupported structural elements are represented explicitly as
[unsupported equation: ...]instead of being silently flattened into apotentially incorrect expression.
Because the fix is implemented in the shared DOCX extractor, the preserved
equations reach:
text_onlyparsing path used for knowledge ingestionThe tests build valid DOCX files containing real OMML nodes rather than
mocking the extracted text.
Related Issues
Module(s) Affected
agentsapiconfigcoreknowledgeloggingservicestoolsutilsweb(Frontend)docs(Documentation)scriptstests...Checklist
dev(notmain).pre-commit run --all-filesand fixed any issues.Validation
Focused DOCX, parsing, attachment, and reading tests:
Additional Notes
I noticed #2154 after completing this implementation. The two PRs overlap on
the core fraction, script, and radical handling.
This implementation additionally focuses on:
flattening them;
Immersive Reading.