-
Apologies but what is probably a basic question but I am having a hard time getting my custom CSS for the Mermaid.js support to take.
extra_css:
- stylesheets/admonitions.css
- stylesheets/extra.css
- stylesheets/icons.css
- stylesheets/mermaid.css
Looking at the inspector I even tried adding things like: #__mermaid_0 .note {
stroke: #0c1e58 !important;
fill: #0c1e58 !important;
} Even with that I was unsuccessful. Any advice would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Thanks for asking. Unfortunately, you cannot override Mermaid's CSS with additional CSS, because Mermaid.js diagrams must be encapsulated in shadow DOMs due to duplicate identifiers which lead to undefined behavior. If you wish to add or change some of the CSS Material for MkDocs applies to Mermaid.js, you would need to make your changes here and rebuild the theme. I recommend reading #2170 and mermaid-js/mermaid#1318 to understand the current design limitations. |
Beta Was this translation helpful? Give feedback.
-
Thank you! So it might be a better solution (if required) to generate the Mermaid chart outside of mkdocs as a SVG with the custom CSS and then import that image? |
Beta Was this translation helpful? Give feedback.
-
Depending on your needs, Mermaid's built-in styling features may be enough for your use case since they support changing stroke and fill colors. This is what I am referring to in the official docs, please scroll down to the "Styling links" section. I have a working example of that: "mermaid And the result on the page (using Material for Mkdocs), scroll all the way down. |
Beta Was this translation helpful? Give feedback.
Thanks for asking. Unfortunately, you cannot override Mermaid's CSS with additional CSS, because Mermaid.js diagrams must be encapsulated in shadow DOMs due to duplicate identifiers which lead to undefined behavior. If you wish to add or change some of the CSS Material for MkDocs applies to Mermaid.js, you would need to make your changes here and rebuild the theme.
I recommend reading #2170 and mermaid-js/mermaid#1318 to understand the current design limitations.