Skip to content

feat(math): implement m:sPre pre-sub-superscript converter#2747

Merged
caio-pizzol merged 5 commits intosuperdoc-dev:mainfrom
Abdeltoto:feat/math-pre-sub-superscript-converter
Apr 12, 2026
Merged

feat(math): implement m:sPre pre-sub-superscript converter#2747
caio-pizzol merged 5 commits intosuperdoc-dev:mainfrom
Abdeltoto:feat/math-pre-sub-superscript-converter

Conversation

@Abdeltoto
Copy link
Copy Markdown
Contributor

Closes #2609

Summary

  • Implements the \m:sPre\ OMML-to-MathML converter (prescripts on the left of a base)
  • Maps \m:sPre\ to MathML <mmultiscripts>\ with <mprescripts/>\ separator
  • Registers the converter in \MATH_OBJECT_REGISTRY\
  • Adds 2 unit tests covering standard usage and missing sub/sup

Spec reference

ECMA-376 Section 22.1.2.99

Test plan

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

Made with Cursor

- Correct JSDoc OMML child order to spec (sPrePr, sub, sup, e) per ECMA-376 §22.1.2.99
- Move m:sPre into the implemented section of the converter registry
- Add sibling-parity unit tests: properties-element filter, multi-run mrow wrap
- Assert children.length === 4 in missing-case test to lock in arity invariant
- Relocate describe block next to m:sSubSup; align test name with sibling convention
- Reorder happy-path fixture to spec-correct child order
- Add behavior tests + math-spre-tests.docx fixture covering 9 m:sPre shapes
  (basic, isotope, multi-run, only-sub, only-sup, no sPrePr, fraction-in-sub,
  nested sPre, display-mode oMathPara)
- Add m:sPre round-trip test in math importer for child-order preservation
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 thanks for this — nice work. tested it in the app with a bunch of real equations (isotopes, multi-character scripts, nested pre-scripts, edge cases) and it renders the same as Word does.

i pushed two small commits directly since the changes were mechanical. first one — the comment at the top of the converter said Word writes the tags in the order base, sub, sup but Word actually sends them sub, sup, base. fixed the comment, reordered the test fixture to match what Word really produces, moved the registry entry out of the "not yet implemented" list it was still sitting in, and added a few more unit tests plus a new behavior test that loads a real .docx with nine pre-script shapes and checks each one renders right. second one — added one more test so if anyone changes how math gets saved back out, we catch it before a doc comes back different than it went in.

also uploaded the test doc to the shared corpus so the visual and layout regression runs pick it up automatically.

good to merge from my side once CI is green — flag anything you'd rather roll back.

@caio-pizzol caio-pizzol enabled auto-merge April 12, 2026 21:28
@caio-pizzol caio-pizzol disabled auto-merge April 12, 2026 21:32
@caio-pizzol caio-pizzol enabled auto-merge April 12, 2026 21:32
@caio-pizzol caio-pizzol added this pull request to the merge queue Apr 12, 2026
Merged via the queue into superdoc-dev:main with commit aa0d15d Apr 12, 2026
51 checks passed
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

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

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:sPre pre-sub-superscript converter (community)

3 participants