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
Following on from a great PR #1599 by @jgreywolf and the original issue reported #1181, I've been trying to apply custom css to different elements within a class diagrams and seem to have come across a few issues I thought it was worth reporting.
The issues I've listed below are in the order I found them
The documentation states that something like the below should apply the relevant CSS to an element, but I'm seeing a syntax error
This seems to be due to a typo in the documentation which states a semi-colon is needed when assigning the CSS cssClass "nodeId1" cssClass;
Removing the semi-colon fixes this (I spotted an example in the tests without a semi colon) cssClass "nodeId1" cssClass
After this it worked, well, kind of... I was able to apply custom CSS, but only to CSS properties that aren't already being used, so existing properties weren't being overridden
To get round this I added !important to the properties I want to override, but this obviously isn't ideal.
The class name is being correctly assigned to the node, but because the default styles are being assigned via a <style> tag inside the <svg> tag, and the default style selectors use a css id, it’s very difficult to override the default styles (hence the need for !important)
I'm not sure if this issue would be picked up in the tests, I could be wrong but from what I can see the tests check to see if a SVG is generated, not whether they contain the correct colours?
Device: Macbook Pro
OS: macOS Big Sur 11.4
Browser Chrome
Version 91.0.4472.114 (Official Build) (x86_64)
I'm no js expert, but thought I'd post this in the hope someone might pick it up, or maybe this will help someone work around a problem instead of spending a couple of hours figuring out why their diagrams aren't working as expected
The text was updated successfully, but these errors were encountered:
I tried to replicate the CSS styling for classDiagram as in documentation on styling but I got the error "Syntax error in graph mermaid version 8.12.1".
Here is a JSFiddle to showcase the error. It takes the exact example (classDiagram) from the documentation: https://jsfiddle.net/4k8n5bd3/ .
Following on from a great PR #1599 by @jgreywolf and the original issue reported #1181, I've been trying to apply custom css to different elements within a class diagrams and seem to have come across a few issues I thought it was worth reporting.
The issues I've listed below are in the order I found them
The documentation states that something like the below should apply the relevant CSS to an element, but I'm seeing a syntax error
This seems to be due to a typo in the documentation which states a semi-colon is needed when assigning the CSS
cssClass "nodeId1" cssClass;
Removing the semi-colon fixes this (I spotted an example in the tests without a semi colon)
cssClass "nodeId1" cssClass
After this it worked, well, kind of... I was able to apply custom CSS, but only to CSS properties that aren't already being used, so existing properties weren't being overridden
To get round this I added
!important
to the properties I want to override, but this obviously isn't ideal.The class name is being correctly assigned to the node, but because the default styles are being assigned via a
<style>
tag inside the<svg>
tag, and the default style selectors use a css id, it’s very difficult to override the default styles (hence the need for!important
)I'm not sure if this issue would be picked up in the tests, I could be wrong but from what I can see the tests check to see if a SVG is generated, not whether they contain the correct colours?
I'm no js expert, but thought I'd post this in the hope someone might pick it up, or maybe this will help someone work around a problem instead of spending a couple of hours figuring out why their diagrams aren't working as expected
The text was updated successfully, but these errors were encountered: