Skip to content

fix(math): propagate paragraph spacing to display math blocks (SD-2409)#2645

Merged
caio-pizzol merged 1 commit intomainfrom
caio/sd-2409-math-display-paragraphs-missing-prepost-spacing
Mar 30, 2026
Merged

fix(math): propagate paragraph spacing to display math blocks (SD-2409)#2645
caio-pizzol merged 1 commit intomainfrom
caio/sd-2409-math-display-paragraphs-missing-prepost-spacing

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Display math paragraphs (m:oMathPara) were rendering with no vertical spacing β€” text and equations were cramped together. Word shows proper breathing room because the containing w:p paragraph's spacing properties apply.

The root cause: when mathBlock is hoisted out of its parent w:p during import, the paragraph's spacing properties were dropped. The layout engine saw zero spacing.

Fix: thread paragraphProperties from the parent w:p through the mathBlock PM node, then resolve them in the pm-adapter via computeParagraphAttrs β€” same as regular paragraphs.

  • Importer: capture paragraphProperties from extraParams on mathBlock attrs
  • PM schema: add paragraphProperties attribute to mathBlock
  • pm-adapter: call computeParagraphAttrs to resolve spacing, borders, indent
  • Tests: importer passthrough + pm-adapter spacing resolution + alignment fallback

SD-2409

@linear
Copy link
Copy Markdown

linear Bot commented Mar 30, 2026

@github-actions
Copy link
Copy Markdown
Contributor

Status: PASS

The PR's OOXML changes are spec-compliant. Here's what I checked:

Elements and attributes used:

  • m:oMathPara, m:oMathParaPr, m:jc (with m:val) β€” all valid OOXML math elements per Β§22.1.2.79 and Β§22.1.2.51
  • m:oMath, m:r, m:t β€” valid per Β§22.1.2.87 and Β§22.1.2.116
  • The paragraphProperties attribute is an internal carrier (not an OOXML construct) that ferries already-parsed w:pPr data between pipeline layers β€” no spec concern there

Default value for m:jc: The spec (Β§22.1.2.51) says the default when m:jc is absent is centerGroup, and the code correctly returns 'centerGroup' on lines 12 and 14. βœ“

One pre-existing issue worth noting (not introduced by this PR, but in the touched file):

Line 15 of math-importer.js:

return jc.attributes['m:val'] || 'center';

When m:jc is present but m:val is an empty string, this falls back to 'center'. But the spec says the default in that case is also centerGroup. Should be || 'centerGroup'. See https://ooxml.dev/spec?q=jc+justification+math for the relevant clause. Minor edge case since a well-formed document won't have an empty m:val, but worth fixing.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcaa575dea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 πŸ‘.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@caio-pizzol caio-pizzol force-pushed the caio/sd-2409-math-display-paragraphs-missing-prepost-spacing branch from dcaa575 to 7b320c2 Compare March 30, 2026 18:03
@caio-pizzol caio-pizzol self-assigned this Mar 30, 2026
@caio-pizzol caio-pizzol force-pushed the caio/sd-2409-math-display-paragraphs-missing-prepost-spacing branch from db80c1d to cd9fa6a Compare March 30, 2026 21:00
@caio-pizzol caio-pizzol force-pushed the caio/sd-2409-math-display-paragraphs-missing-prepost-spacing branch from cd9fa6a to caa7458 Compare March 30, 2026 21:35
@caio-pizzol caio-pizzol enabled auto-merge (squash) March 30, 2026 21:35
@caio-pizzol caio-pizzol merged commit a8859df into main Mar 30, 2026
39 checks passed
@caio-pizzol caio-pizzol deleted the caio/sd-2409-math-display-paragraphs-missing-prepost-spacing branch March 30, 2026 21:38
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in vscode-ext v1.1.0-next.50

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in template-builder v1.3.0-next.6

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in esign v2.2.0-next.7

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in superdoc v1.24.0-next.47

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in superdoc-cli v0.5.0-next.47

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in superdoc-sdk v1.3.0-next.47

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in superdoc v1.24.1

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

πŸŽ‰ This PR is included in superdoc-cli v0.5.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

πŸŽ‰ This PR is included in superdoc-sdk v1.3.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

πŸŽ‰ This PR is included in vscode-ext v2.2.0

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.

1 participant