diff --git a/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.test.ts b/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.test.ts index 4330cb04d2..df9206301c 100644 --- a/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.test.ts +++ b/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.test.ts @@ -30,6 +30,7 @@ describe('convertOmmlToMathml', () => { expect(result).not.toBeNull(); expect(result!.namespaceURI).toBe(MATHML_NS); expect(result!.localName).toBe('math'); + expect(result!.getAttribute('displaystyle')).toBe('true'); // Should contain an for the identifier 'x' const mi = result!.querySelector('mi'); @@ -94,6 +95,8 @@ describe('convertOmmlToMathml', () => { const result = convertOmmlToMathml(omml, doc); expect(result).not.toBeNull(); expect(result!.localName).toBe('math'); + expect(result!.getAttribute('displaystyle')).toBe('true'); + expect(result!.getAttribute('display')).toBe('block'); // The m:oMathParaPr should be skipped (it ends with 'Pr') // The m:oMath child should produce content expect(result!.textContent).toBe('y'); diff --git a/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts b/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts index 6d64993a4c..a1ebe7e950 100644 --- a/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts +++ b/packages/layout-engine/painters/dom/src/features/math/omml-to-mathml.ts @@ -157,6 +157,11 @@ export function convertOmmlToMathml(ommlJson: unknown, doc: Document): Element | const root = ommlJson as OmmlJsonNode; const mathEl = doc.createElementNS(MATHML_NS, 'math'); + mathEl.setAttribute('displaystyle', 'true'); + + if (root.name === 'm:oMathPara') { + mathEl.setAttribute('display', 'block'); + } // For m:oMathPara, iterate over child m:oMath elements // For m:oMath, process directly