feat(math): implement m:box and m:borderBox converters#2750
feat(math): implement m:box and m:borderBox converters#2750Abdeltoto wants to merge 3 commits intosuperdoc-dev:mainfrom
Conversation
…oc-dev#2605) Made-with: Cursor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6157dcc02b
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const base = elements.find((e) => e.name === 'm:e'); | ||
|
|
||
| const isOn = (el?: { attributes?: Record<string, string> }) => | ||
| el && (el.attributes?.['m:val'] === '1' || el.attributes?.['m:val'] === 'on' || !el.attributes); |
There was a problem hiding this comment.
Parse ST_OnOff "true" values in borderBox flags
isOn only treats m:val="1" and m:val="on" as enabled, so valid ST_OnOff values like m:val="true" are interpreted as false. In those documents, hide/strike flags on m:borderBoxPr are silently ignored and the rendered MathML notation is wrong (e.g., borders shown when they should be hidden).
Useful? React with 👍 / 👎.
| if (notations.length > 0) { | ||
| menclose.setAttribute('notation', notations.join(' ')); | ||
| } |
There was a problem hiding this comment.
Set explicit notation when borderBox hides all sides
When all four m:hide* flags are on and no strike notation is added, notations stays empty and the code omits the notation attribute entirely. A <menclose> without notation uses the MathML default (longdiv), so this path renders an unintended enclosure instead of a fully hidden border box.
Useful? React with 👍 / 👎.
Made-with: Cursor
…trikes Made-with: Cursor
Closes #2605
Summary
m:box(invisible grouping container) as MathML<mrow>m:borderBox(bordered box) as MathML<menclose>with configurable notationsm:hideTop,m:hideBot,m:hideLeft,m:hideRight) and strike flags (m:strikeH,m:strikeV,m:strikeBLTR,m:strikeTLBR)MATH_OBJECT_REGISTRYSpec reference
ECMA-376 Sections 22.1.2.13 (box) and 22.1.2.11 (borderBox)
Test plan
vitest runpasses for omml-to-mathml.test.ts