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

sphinxcontrib-mermaid 1.0.0 HTML rendering incorrect compared to 0.9.2 #163

Closed
lytn1ng opened this issue Nov 11, 2024 · 6 comments
Closed

Comments

@lytn1ng
Copy link

lytn1ng commented Nov 11, 2024

Here is an example diagram - note that the connectors are arrow-less:

---
caption: Test Diagram
---
flowchart TD;
%%flowchart-elk TD;
id1("One")---id2("Two");
id1("One")---id3("Three");
Loading

Here's how the HTML renders with sphinxcontrib-mermaid 0.9.2:

image

  1. The diagram appears to be rendered directly on the dark background (i.e. no colored box).
  2. The connector lines are visible even in dark mode

However, with 1.0.0, here's how it looks:
image

  1. There's a gray-ish box around the diagram
  2. There are no connectors visible in dark mode

And this is how it looks with 1.0.0 in Light mode:
image

  1. There is still a gray-ish box around the diagram
  2. The connectors are visible - but they have arrows

Please fix this. issue But for now, 0.9.2 still works well enough with Sphinx 8.1.3.

@timkpaine
Copy link
Collaborator

This is not what it looks like for me, cannot reproduce. Please provide code or if you’re using any customizations.

@timkpaine timkpaine closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
@lytn1ng
Copy link
Author

lytn1ng commented Nov 11, 2024

Thanks for the quick response, @timkpaine.

What does it look like for you?

I had included the code in my original issue report but it has been converted to a diagram. I am adding it here again without the back-ticks (hopefully it's readable)


mermaid
flowchart TD;
%%flowchart-elk TD;
id1("One")---id2("Two");
id1("One")---id3("Three");

As for customizations: I'm not using anything for mermaid. I am using Sphinx, myst-parser, ablog and the sphinx-book-theme.

In my testing, the only things I did were:
pip install sphinxcontrib-mermaid (this installed 1.0.0).

The HTML diagram looked odd.

Then, I did
pip uninstall sphinxcontrib-mermaid
pip install sphinxcontrib-mermaid==0.9.2

And then I ran the "make html" command - the diagram looked ok again in the HTML.

@timkpaine
Copy link
Collaborator

timkpaine commented Nov 11, 2024

Furo:
Screenshot 2024-11-10 at 23 31 09
Screenshot 2024-11-10 at 23 31 16

sphinx-book-theme:
Screenshot 2024-11-10 at 23 40 38
Screenshot 2024-11-10 at 23 40 42

css rule in sphinx-book-theme causing the problem:
Screenshot 2024-11-10 at 23 40 56

We render in pre tag since #133

@lytn1ng
Copy link
Author

lytn1ng commented Nov 11, 2024

Thank you, @timkpaine.

I think your results match mine - at least with the sphinx-book-theme.

However, the rendering is still wrong in 1.0.0 - even in Furo - since the connecting lines have arrows. According to the code, there should be no arrows.

Whereas, irrespective of the CSS, it works in 0.9.2. The connecting lines have no arrows when using 0.9.2.

@timkpaine
Copy link
Collaborator

The code should have arrows, I don't see anything wrong. mermaid live link

@lytn1ng
Copy link
Author

lytn1ng commented Nov 12, 2024

Thanks again for looking into this, @timkpaine.

I agree that sphinxcontrib-mermaid 1.0.0 is rendering the image just like the mermaid live editor (i.e. with arrows).

However, there is an issue in the Mermaid github talking about this exact same issue with arrows. Hopefully, once it's fixed upstream, it'll be fixed here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants