Skip to content

Math Equation Rendering (OMML → MathML) #2681

@caio-pizzol

Description

@caio-pizzol

SuperDoc converts Office Math (OMML) from Word documents into browser-native MathML. No KaTeX. No MathJax. No external dependencies. The browser renders the math directly.

How it works

.docx → OMML XML → ProseMirror → Layout Engine → DomPainter → <math> DOM

The importer extracts m:oMath elements and stores the full OMML tree as a JSON attribute on atomic ProseMirror nodes. At render time, the DomPainter walks the tree and converts each OMML element to its MathML equivalent via a converter registry. The browser does the rest.

Export round-trips cleanly — the original XML is preserved via carbonCopy.

What's built

  • Import pipeline — m:oMath (inline) and m:oMathPara (display) both import as proper PM nodes
  • ProseMirror schema — mathInline and mathBlock atomic nodes
  • Layout engine — MathRun type, measured as atomic units like images
  • DomPainter rendering — converter registry, renderMathRun(), cursor positioning
  • Leaf nodes — m:r / m:t text classification (<mi>, <mo>, <mn>)
  • Fraction — m:f<mfrac>, working proof of concept
  • 47 unit tests across the pipeline

What's left: 14 converters

Each converter is one function. ~20 lines of TypeScript. One file, two one-line registrations, a test. No schema changes. No adapter changes. No exporter changes.

Contribution guide: CONTRIBUTING.md

Done

Easy

Medium

Hard

How to pick one up

  1. Grab an issue from the list above
  2. Read the contribution guide
  3. Follow the pattern in converters/fraction.ts
  4. Each issue has a .docx test file attached — upload it to the dev app to verify your converter works
  5. Open a PR

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions