Skip to content

feat: [US-041] DOCX parser - OMML math equations#7

Merged
developer0hye merged 2 commits into
mainfrom
ralph/phase4-polish
Feb 27, 2026
Merged

feat: [US-041] DOCX parser - OMML math equations#7
developer0hye merged 2 commits into
mainfrom
ralph/phase4-polish

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

  • Parse OMML (Office Math Markup Language) elements from DOCX paragraphs (m:oMath, m:oMathPara)
  • Convert OMML elements to Typst math notation: fractions, super/subscripts, radicals, delimiters, n-ary operators, accents, matrices, equation arrays
  • Add MathEquation IR type with inline/display math support
  • Integrate via raw ZIP XML scanning pattern (same as WrapContext/NoteContext) since docx-rs doesn't parse m: namespace

Key changes

  • New module parser/omml.rs: OMML-to-Typst converter with omml_to_typst() and scan_math_equations() functions
  • IR extension ir/elements.rs: MathEquation struct and Block::MathEquation variant
  • Parser integration parser/docx.rs: MathContext for body-child-index correlation between raw XML scan and docx-rs document tree
  • Codegen render/typst_gen.rs: Typst $...$ (inline) and $ ... $ (display) math rendering

Test plan

  • 13 unit tests for OMML conversion (fraction, superscript, subscript, sub+superscript, square root, nth root, parentheses, complex equation, sum with limits, E=mc², quadratic formula, scan display/inline/multiple)
  • 3 DOCX integration tests (display math fraction, inline math superscript, complex math)
  • 3 codegen tests (display math, inline math, complex math)
  • 427 library tests pass
  • cargo clippy --workspace -- -D warnings passes
  • cargo fmt --all --check passes

🤖 Generated with Claude Code

developer0hye and others added 2 commits February 27, 2026 12:59
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Fix depth tracking bug in scan_math_equations, collapse nested if
blocks for clippy, and mark US-041 as complete in PRD.

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 10236e0 into main Feb 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant