Skip to content

fix(math): use U+2015 for underbar accent instead of U+0332 (SD-2403)#2621

Open
caio-pizzol wants to merge 3 commits intomainfrom
caio/sd-2403-math-underbar-u0332-renders-invisibly-in-some-cases
Open

fix(math): use U+2015 for underbar accent instead of U+0332 (SD-2403)#2621
caio-pizzol wants to merge 3 commits intomainfrom
caio/sd-2403-math-underbar-u0332-renders-invisibly-in-some-cases

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Replace U+0332 (combining low line) with U+2015 (horizontal bar) for the math underbar accent character. U+0332 is a combining character that renders invisibly in some browsers when used as a standalone MathML operator inside <mo>. U+2015 is a non-combining character that renders consistently.

Also moves m:f (fraction) to the "Implemented" section in the math object registry — it was listed under "Not yet implemented" despite having a converter.

  • Swap underbar accent from \u0332 to \u2015 in bar.ts
  • Update test expectations to match
  • Move m:f to correct registry section

Depends on #2619.

SD-2403

Closes #2610

- Add convertBar() in converters/bar.ts:
  - Reads m:barPr/m:pos@m:val to determine position
  - 'top' (default) → <mover> with U+203E (overline)
  - 'bot' → <munder> with U+0332 (combining low line)
  - stretchy='true' so the bar stretches over the base expression
- Register 'm:bar': convertBar in MATH_OBJECT_REGISTRY
- Export convertBar from converters/index.ts
- Add 3 unit tests: overbar, underbar, missing barPr fallback
- Default to munder (underbar) when no position is specified,
  matching Word's rendering behavior (posVal !== 'top')
- Wrap base content in <mrow> to correctly group multi-token
  expressions like 'x + y' as a single MathML child
- Move m:bar entry from 'Not yet implemented' to 'Implemented'
  section in the registry
- Strengthen tests: assert base content text and <mo> character
  for all three cases (top, bot, default)
U+0332 (combining low line) renders invisibly in some browsers when used
as a standalone MathML operator. Replace with U+2015 (horizontal bar)
which renders consistently. Also moves m:f to the "Implemented" section
in the math object registry.
@linear
Copy link
Copy Markdown

linear bot commented Mar 28, 2026

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.

2 participants