You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@streamdown/mermaid: plugin defaults override Mermaid's own theme and font #714
Because of that, there's no way to get Mermaid's own theme and font back. On Mermaid 12, whose default theme is now redux-color, every diagram still draws with the old default theme in a monospace font.
Passing theme: undefined gets around the theme. Passing fontFamily: undefined doesn't help: Mermaid only writes its --mermaid-font-family rule when fontFamily is set, so the diagram ends up with no font rule at all.
We ended up writing our own small plugin so chat diagrams match the ones we draw elsewhere with Mermaid's defaults.
Could the plugin keep only the settings it needs (startOnLoad: false, and probably securityLevel and suppressErrorRendering) and leave theme and fontFamily to Mermaid unless the caller sets them? That changes how diagrams look for anyone relying on today's defaults, so it might need a major version or an opt-in option.
Seen on @streamdown/mermaid 1.0.3 (also current main) with mermaid 12.3.0. Happy to send a PR.
Hi! I'd like to work on this issue. I'll fix the Mermaid theme and font configuration so native defaults are respected, and add tests to verify the changes.
Feasibility check from a would-be contributor: I'm holding off on a PR here, since the reporter has already offered to send one and @DeepanB15 asked to be assigned yesterday. A competing PR wouldn't help.
Some technical notes that may help whoever picks this up:
createMermaidPlugin spreads defaultConfig under options.config, so theme: 'default' and fontFamily: 'monospace' are always applied unless the caller overrides them. Per the report, theme: undefined restores Mermaid's theme but fontFamily: undefined leaves the diagram with no font rule.
Dropping theme and fontFamily from the defaults changes the look for existing users, so it probably needs a maintainer decision on semver (major) versus an opt-in. One opt-in shape would be a flag like useMermaidDefaults, or a way to pass null or undefined that actually removes the key. The current behaviour would stay the default.
Tests should cover three cases: no config, user-supplied theme/font, and the opt-out path. They should also check that startOnLoad, securityLevel and suppressErrorRendering stay enforced.
Thanks for the detailed technical insights! I'll wait for the maintainer's guidance on the backward-compatible approach and assignment before proceeding. Appreciate the help!
Go ahead @DeepanB15, I won't send a competing PR. An opt-in like @sleitor describes works for us. We just need theme and fontFamily left to Mermaid, so its own defaults apply.
Activity
DeepanB15 commentedon Nov 8, 2026
Hi! I'd like to work on this issue. I'll fix the Mermaid theme and font configuration so native defaults are respected, and add tests to verify the changes.
Could you assign this issue to me?
sleitor commentedon Nov 9, 2026
Feasibility check from a would-be contributor: I'm holding off on a PR here, since the reporter has already offered to send one and @DeepanB15 asked to be assigned yesterday. A competing PR wouldn't help.
Some technical notes that may help whoever picks this up:
createMermaidPluginspreadsdefaultConfigunderoptions.config, sotheme: 'default'andfontFamily: 'monospace'are always applied unless the caller overrides them. Per the report,theme: undefinedrestores Mermaid's theme butfontFamily: undefinedleaves the diagram with no font rule.themeandfontFamilyfrom the defaults changes the look for existing users, so it probably needs a maintainer decision on semver (major) versus an opt-in. One opt-in shape would be a flag likeuseMermaidDefaults, or a way to passnullorundefinedthat actually removes the key. The current behaviour would stay the default.startOnLoad,securityLevelandsuppressErrorRenderingstay enforced.DeepanB15 commentedon Nov 9, 2026
Thanks for the detailed technical insights! I'll wait for the maintainer's guidance on the backward-compatible approach and assignment before proceeding. Appreciate the help!
aryakapoor commentedon Nov 9, 2026
Go ahead @DeepanB15, I won't send a competing PR. An opt-in like @sleitor describes works for us. We just need
themeandfontFamilyleft to Mermaid, so its own defaults apply.DeepanB15 commentedon Nov 10, 2026
Thanks for confirming! I'll proceed with the opt-in approach, maintain backward compatibility, and add the necessary tests before submitting a PR.