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

Theming of lineColor using directives spills over into subsequent diagrams #1871

Closed
knsv opened this issue Jan 27, 2021 · 2 comments · Fixed by #4825
Closed

Theming of lineColor using directives spills over into subsequent diagrams #1871

knsv opened this issue Jan 27, 2021 · 2 comments · Fixed by #4825

Comments

@knsv
Copy link
Collaborator

knsv commented Jan 27, 2021

When setting the line color in a page this affects the styling of the arrowheads, the markers in svg. These ids are not properly contained within each svg. This results in the subsequent diagrams linking to the arrowhead definitions highest up in the page.

This can easily be reproduced by the example below:

image

<html>
  <head>
  </head>
  <body>
  <h1>Example</h1>
  <div class="mermaid">
%%{init:{"theme":"base", "themeVariables": {"lineColor":"red"}}}%%
flowchart LR
subgraph red
A --> B
end
  </div>
  <div class="mermaid">
%%{init:{"theme":"base", "themeVariables": {"lineColor":"blue"}}}%%
flowchart LR
subgraph black
A --> B
end
  </div>
  <script src="//cdn.jsdelivr.net/npm/mermaid@8.9.0/dist/mermaid.min.js"></script>
  <!-- <script src="http://localhost:9000/mermaid.js"></script> -->
  <script>
      mermaid.initialize({
      });
      function callback(){alert('It worked');}
    </script>
</body>
</html>
@dwhelan
Copy link

dwhelan commented Sep 27, 2022

@knsv I have a fix for this where the marker id is now prefixed with the id of its diagram svg element.

image

I think this is an important fix as there are three related issues as well as a new one from livebook-dev/livebook#1440.

I would love to get this fix pushed ... but I am not a collaborator. What would you suggest for next steps?

@bjarkih
Copy link

bjarkih commented Oct 7, 2022

I would also love to see a fix for this - happy to help review the pull request from @dwhelan for example. We're seeing the same issue in our Mermaid integration in our presentation app and it's a bit of a blocker at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
@dwhelan @jgreywolf @bjarkih @knsv @Yokozuna59 and others