Skip to content

feat(math): expose equation font via --sd-math-font-family (SD-2634) - #2880

Closed
caio-pizzol wants to merge 1 commit into
mainfrom
caio/sd-2634-math-respect-consumertheme-font
Closed

feat(math): expose equation font via --sd-math-font-family (SD-2634)#2880
caio-pizzol wants to merge 1 commit into
mainfrom
caio/sd-2634-math-respect-consumertheme-font

Conversation

@caio-pizzol

Copy link
Copy Markdown
Contributor

Consumer CSS couldn't override the hardcoded font-family: "Cambria Math", math on rendered <math> elements without !important. Swaps the inline style to var(--sd-math-font-family, "Cambria Math", math) and registers the token with the existing Cambria Math default in variables.css. Painter-dom embedders that don't ship the superdoc stylesheet still get the same rendering via the var() fallback — no behavior change for anyone who doesn't opt in.

Rejected: dropping the inline style entirely in favor of a stylesheet rule. The painter-dom bundle is consumed standalone by some integrations (MCP/CLI rendering pipelines) without the main superdoc CSS, so the inline var() + fallback is the only place the default reliably lands for all consumers.
Review: token placement in variables.css — I put it next to --sd-proofing-* since it's document-content tier, not UI. Open to moving it.
Verified: 184/184 unit (+1 regression test pinning the style attribute), 74/74 math behavior tests, type-check clean.

Previously every rendered <math> element got an inline
`font-family: "Cambria Math", math` style that consumer CSS couldn't
override without `!important`. Replace with
`font-family: var(--sd-math-font-family, "Cambria Math", math)` and
register the `--sd-math-font-family` token (default `'Cambria Math', math`)
in variables.css.

The var() fallback preserves current behavior for embedders that ship
painter-dom without the superdoc stylesheet.
@linear

linear Bot commented Apr 21, 2026

Copy link
Copy Markdown

@caio-pizzol

Copy link
Copy Markdown
Contributor Author

Closing as speculative — no concrete user or customer need for theming the math font. Current Cambria Math default matches Word and works across all known consumers. Will revisit if a real theming ask surfaces.

@caio-pizzol
caio-pizzol deleted the caio/sd-2634-math-respect-consumertheme-font branch April 21, 2026 11:14
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants