Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isolate class styling to the svg container #92

Closed
timelyportfolio opened this issue Jan 7, 2015 · 3 comments · May be fixed by GerHobbelt/mermaid#11
Closed

isolate class styling to the svg container #92

timelyportfolio opened this issue Jan 7, 2015 · 3 comments · May be fixed by GerHobbelt/mermaid#11
Assignees
Labels
Status: Approved Is ready to be worked on

Comments

@timelyportfolio
Copy link

I'm not sure it this is intended or unintended, but the styles added through classDef will apply to all diagrams on a page that contains multiple diagrams. If we consider the example,

<div class = 'mermaid'>
graph TD;
     classDef exClass opacity:0.5 !important;
     a-->b;
     class a exClass;
</div>
<div>
graph TD;
     a-->b;
     class a exClass;
</div>

If this is unintended, and isolating the class styles to only the diagram in which they are part of the spec, I think we can change this line from

                embeddedStyles += '.' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';

to

                embeddedStyles += svg.id + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';            

Thanks again for such a great project.

@knsv
Copy link
Collaborator

knsv commented Jan 7, 2015

Thats for your feedback. I think you have a good point. Perhaps the order of styles should be something like this:

  1. Use default styles hardcoded in mermaid - when no styles whatsoever are defined default style f
  2. Use default styles from css (node) - when defined and no other styles are in place
  3. Use diagram default styles - when defined and no other styles are in place
  4. Use node specific classes when defined

(Higher number higher precedence)
@bjowes, what do you think?

@bjowes
Copy link
Contributor

bjowes commented Jan 11, 2015

Agreed. I will include a fix for this in my work on #58.

@bjowes bjowes self-assigned this Jan 11, 2015
@bjowes bjowes added Status: Approved Is ready to be worked on styling labels Jan 11, 2015
@knsv
Copy link
Collaborator

knsv commented Jan 25, 2015

This has been included in release 0.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Approved Is ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants