feat(math): implement m:eqArr equation-array converter#2754
feat(math): implement m:eqArr equation-array converter#2754caio-pizzol merged 5 commits intosuperdoc-dev:mainfrom
Conversation
…oc-dev#2607) Made-with: Cursor
Per ECMA-376 §22.1.2.34, '&' characters inside m:t elements within an equation array are alignment markers, not literal text. Without mapping them to MathML <maligngroup>/<malignmark> (poorly supported in browsers), the previous implementation rendered them as literal ampersands. Strip '&' from m:t text before recursing into row children so real-world documents with aligned equations render cleanly. Also adds tests covering the m:eqArrPr filter and nested-math recursion paths.
Adds math-eqarr-tests.docx fixture with 5 Word-native equation arrays: basic, nested fraction, nested subscript, alignment markers, and m:eqArrPr properties. New test.describe block follows the convention established by limLow/limUpp, delimiter, radical, and func suites — verifying mtable structure, nested-math recursion, alignment-marker stripping, and m:eqArrPr property filtering. Also registers the fixture in the R2 rendering corpus (sd-2754) so layout and visual regression suites will auto-discover it.
Align with sibling math converters (fraction, subscript, radical, bar, function, limits) which all create an explicit <mrow> inside their container elements. MathML's implicit mrow semantics mean the rendered output is unchanged, but this matches the directory convention and makes the JSDoc shape match the code.
caio-pizzol
left a comment
There was a problem hiding this comment.
@Abdeltoto nice work, thanks for the PR! i tested it against a doc covering every case and it all held up.
to save us some back and forth, i pushed three small commits to your branch:
- a fix so that
&characters inside equation rows don't show up as literal text (they're alignment hints in the source, not real content) - a small consistency tweak so each row wraps its content the same way the other math converters do
- more tests — a few unit tests plus a test doc and behavior tests matching the pattern the other math converters use. also added a fuller test doc to R2 so the layout and visual tests pick it up automatically.
one thing worth a follow-up later (not this PR): the spacing/alignment properties on the equation array (like row spacing) aren't used yet — same as a few other converters. fine for a first pass. approving.
# Conflicts: # packages/layout-engine/painters/dom/src/features/math/converters/index.ts # packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.test.ts # packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts # tests/behavior/tests/importing/math-equations.spec.ts
|
🎉 This PR is included in vscode-ext v2.3.0-next.9 |
|
🎉 This PR is included in template-builder v1.5.0-next.9 The release is available on GitHub release |
|
🎉 This PR is included in esign v2.3.0-next.9 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.6 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.26.0-next.9 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.7.0-next.10 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.6.0-next.7 |
Closes #2607
Summary
m:eqArrOMML-to-MathML converter for equation arrays (systems of equations)m:eqArrto a left-aligned<mtable columnalign="left">with one<mtd>cell per rowm:m(matrix), equation arrays usem:eelements directly as rowsMATH_OBJECT_REGISTRYSpec reference
ECMA-376 Section 22.1.2.34
Test plan
vitest runpasses for omml-to-mathml.test.ts