Skip to content

feat(math): implement m:acc accent converter#2748

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

feat(math): implement m:acc accent converter#2748
caio-pizzol merged 5 commits intosuperdoc-dev:mainfrom
Abdeltoto:feat/math-accent-converter

Conversation

@Abdeltoto
Copy link
Copy Markdown
Contributor

Closes #2604

Summary

  • Implements the m:acc OMML-to-MathML converter (diacritical marks above a base expression)
  • Maps m:acc to MathML <mover accent="true"> with a stretchy <mo> for the accent character
  • Defaults to circumflex (U+0302) when m:chr is absent, matching Word behavior
  • Registers the converter in MATH_OBJECT_REGISTRY
  • Adds 3 unit tests covering tilde, default circumflex, and dot accent

Spec reference

ECMA-376 Section 22.1.2.1

Test plan

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

…y forms

- Distinguish the three m:chr states from ECMA-376 §22.1.2.20: element
  absent → default U+0302; element present with missing/empty m:val →
  character absent (render bare base, no <mover>); m:val set → use it.
  Previous code rendered a circumflex for the "character absent" case.
- Map combining marks (U+0300–U+036F, U+20D6/7) to their ASCII-range
  accent equivalents (^, ~, ¯, arrows, …) before placing in <mo>, so
  MathML renderers can use the stretchy accent operators. Firefox and
  MathJax stretch these across wide bases; Chrome's MathML Core does
  not yet stretch accents but the output is semantically correct.
- Return null when m:e is absent (invalid per CT_Acc), so malformed
  input is dropped silently to match Word's behavior.
- Move the registry entry out of the "Not yet implemented" block in
  omml-to-mathml.ts.
- Expand unit tests from 3 to 11 covering every spec branch, the
  spacing mapping, multi-run base wrapping, and the missing-m:e case.
- Add a behavior test asserting <mover accent="true"> + spacing-form
  <mo> output.

SD-2382
# Conflicts:
#	packages/layout-engine/painters/dom/src/features/math/converters/index.ts
#	packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts
@caio-pizzol caio-pizzol enabled auto-merge April 12, 2026 21:28
# Conflicts:
#	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
# Conflicts:
#	packages/layout-engine/painters/dom/src/features/math/converters/index.ts
#	packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts
@caio-pizzol caio-pizzol disabled auto-merge April 12, 2026 21:59
@caio-pizzol caio-pizzol enabled auto-merge April 12, 2026 21:59
@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 1efe0cc Apr 12, 2026
50 checks passed
@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.7

@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.4

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 template-builder v1.5.0-next.7

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.7

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.7

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.7

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.4

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:acc accent converter (community)

3 participants