feat(math): expose equation font via --sd-math-font-family (SD-2634) - #2880
Closed
caio-pizzol wants to merge 1 commit into
Closed
feat(math): expose equation font via --sd-math-font-family (SD-2634)#2880caio-pizzol wants to merge 1 commit into
caio-pizzol wants to merge 1 commit into
Conversation
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.
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consumer CSS couldn't override the hardcoded
font-family: "Cambria Math", mathon rendered<math>elements without!important. Swaps the inline style tovar(--sd-math-font-family, "Cambria Math", math)and registers the token with the existing Cambria Math default invariables.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.