Skip to content

feat(math): implement m:sSup superscript converter (SD-2372)#2634

Merged
caio-pizzol merged 3 commits intosuperdoc-dev:mainfrom
gpardhivvarma:feat/math-ssup-superscript-converter
Mar 31, 2026
Merged

feat(math): implement m:sSup superscript converter (SD-2372)#2634
caio-pizzol merged 3 commits intosuperdoc-dev:mainfrom
gpardhivvarma:feat/math-ssup-superscript-converter

Conversation

@gpardhivvarma
Copy link
Copy Markdown
Contributor

@gpardhivvarma gpardhivvarma commented Mar 30, 2026

Summary

  • Add OMML m:sSup β†’ MathML <msup> converter following the fraction.ts pattern
  • Move m:f from the "not yet implemented" registry section to "implemented" where it belongs
  • 3 tests: basic conversion (xΒ²), properties element ignored, missing m:sup graceful degradation

Test plan

  • pnpm --filter @superdoc/painter-dom test β€” omml-to-mathml.test.ts passes (17 tests)
  • Upload sd-2372-superscript.docx to dev app and verify superscript renders correctly

Closes #2595

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59a0b942ed

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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.

@gpardhivvarma nice work β€” clean implementation, spec reference is correct.

simple cases like xΒ² work great. compound expressions like (x+1)Β² don't render right β€” the parts end up flat instead of grouped. same thing happens in the subscript PR and fraction.ts, so we'll fix them all together in a follow-up.

nested superscripts, fractions as base, and property handling all work. tests look good.

i made a .docx with 10 variations:

sd-2372-superscript-edge-cases.docx

Word:
image
image

SuperDoc:
image
image

cases 2, 3, and 7 break (the ones with multiple parts in the base or exponent). the rest render correctly.

Add OMML m:sSup β†’ MathML <msup> converter following the fraction.ts
pattern. Also move m:f from the "not yet implemented" registry section
to "implemented" where it belongs.

Closes superdoc-dev#2595
Converters for msup, mfrac were appending raw DocumentFragments
directly, causing multi-token expressions (e.g. x+1) to produce
too many direct children. MathML script/fraction elements require
exactly 2 children. Wrap each operand in <mrow> to group them,
matching the pattern already used by bar.ts.
@gpardhivvarma gpardhivvarma force-pushed the feat/math-ssup-superscript-converter branch from 3faf0d9 to 387ee26 Compare March 31, 2026 09:50
@caio-pizzol caio-pizzol self-assigned this Mar 31, 2026
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.

@gpardhivvarma mrow wrapping is in, fraction fix is a nice bonus. all feedback from last round is addressed.

tested with a 15-case edge case doc (simple, multi-run, nested, cross-converter with fractions and bars, triple nesting, ctrlPr, empty props, sibling superscripts) β€” all pass.

approving.

@caio-pizzol caio-pizzol enabled auto-merge (squash) March 31, 2026 21:14
@caio-pizzol caio-pizzol merged commit 68de253 into superdoc-dev:main Mar 31, 2026
38 checks passed
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Mar 31, 2026

πŸŽ‰ This PR is included in vscode-ext v1.1.0-next.54

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Mar 31, 2026

πŸŽ‰ This PR is included in template-builder v1.3.0-next.11

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Mar 31, 2026

πŸŽ‰ This PR is included in esign v2.2.0-next.12

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Mar 31, 2026

πŸŽ‰ This PR is included in superdoc v1.24.0-next.51

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Mar 31, 2026

πŸŽ‰ This PR is included in superdoc-cli v0.5.0-next.51

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Mar 31, 2026

πŸŽ‰ This PR is included in superdoc-sdk v1.3.0-next.52

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 2, 2026

πŸŽ‰ This PR is included in @superdoc-dev/react v1.0.0-next.11

The release is available on GitHub release

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:sSup superscript converter (community)

2 participants