Skip to content

feat(math): implement m:eqArr equation-array converter#2754

Merged
caio-pizzol merged 5 commits intosuperdoc-dev:mainfrom
Abdeltoto:feat/math-equation-array-converter
Apr 13, 2026
Merged

feat(math): implement m:eqArr equation-array converter#2754
caio-pizzol merged 5 commits intosuperdoc-dev:mainfrom
Abdeltoto:feat/math-equation-array-converter

Conversation

@Abdeltoto
Copy link
Copy Markdown
Contributor

Closes #2607

Summary

  • Implements the m:eqArr OMML-to-MathML converter for equation arrays (systems of equations)
  • Maps m:eqArr to a left-aligned <mtable columnalign="left"> with one <mtd> cell per row
  • Unlike m:m (matrix), equation arrays use m:e elements directly as rows
  • Returns null for empty arrays
  • Registers the converter in MATH_OBJECT_REGISTRY
  • Adds 2 unit tests covering standard system of equations and empty array

Spec reference

ECMA-376 Section 22.1.2.34

Test plan

  • vitest run passes for omml-to-mathml.test.ts
  • Linter and formatter pass (lefthook pre-commit)

caiopizzol and others added 3 commits April 12, 2026 17:28
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.
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
@caio-pizzol caio-pizzol enabled auto-merge April 13, 2026 21:43
@caio-pizzol caio-pizzol added this pull request to the merge queue Apr 13, 2026
Merged via the queue into superdoc-dev:main with commit 4227ebe Apr 13, 2026
50 checks passed
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.9

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in template-builder v1.5.0-next.9

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in esign v2.3.0-next.9

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.6

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in superdoc v1.26.0-next.9

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in superdoc-cli v0.7.0-next.10

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 13, 2026

🎉 This PR is included in superdoc-sdk v1.6.0-next.7

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Math: implement m:eqArr equation array converter (community)

3 participants