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

mermaid cdn change? #110

Closed
brownsarahm opened this issue Feb 21, 2023 · 14 comments · Fixed by lsst-sqre/documenteer#233
Closed

mermaid cdn change? #110

brownsarahm opened this issue Feb 21, 2023 · 14 comments · Fixed by lsst-sqre/documenteer#233

Comments

@brownsarahm
Copy link

I am currently getting a CDN error on diagrams that worked previously.

I noticed that the mermaid.js docs use a different cdn now than what this package loads:

docs:

  <script type="module">
    import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
    mermaid.initialize({ startOnLoad: true });
  </script>

from building a jupyterbook with this extension:

<script src="https://unpkg.com/mermaid/dist/mermaid.min.js"></script>
    <script>mermaid.initialize({startOnLoad:true});</script>

I have verified that manually editing the built html makes the images render.

@PyB1l
Copy link

PyB1l commented Feb 22, 2023

DO we have any updates on this?

@reszelaz
Copy link

I also hit the same issue.

@blujan
Copy link

blujan commented Feb 22, 2023

It looks like the latest release of Mermaid no longer has mermaid.min.js, which breaks the js include. As a workaround, I was able to point to the previous Mermaid version by adding mermaid_version = "9.4.0" to conf.py to restore functionality.

@brownsarahm
Copy link
Author

I got mine up and working for now using my forked copy of this package in my requirements.txt

@rsenft1
Copy link

rsenft1 commented Feb 24, 2023

Any idea how to make this work with a jupyter book? I tried the suggestion in that issue for the requirements.txt but it did not work for me and I don't have a conf.py to modify. I tried adding it to my config.yml but it didn't work. :/

@rsenft1
Copy link

rsenft1 commented Feb 24, 2023

Nevermind, can confirm that pasting the same line from your requirements.txt to mine does work!

@brownsarahm
Copy link
Author

It looks like the latest release of Mermaid no longer has mermaid.min.js, which breaks the js include. As a workaround, I was able to point to the previous Mermaid version by adding mermaid_version = "9.4.0" to conf.py to restore functionality.

This issue is immediate cause of the diagrams not rendering, but separate from the fact that mermaid changed their recommended CDN. I can use 'latest' //this package defaults from the recommended cdn (jsdeliver vs unpkg).

werneta added a commit to com-posers-pit/smw_music that referenced this issue Feb 27, 2023
Ran into this:
mgaitan/sphinxcontrib-mermaid#110

Will need to update to a newer version of the sphinx package.

Re #137

Now playing:
Battleship by Oliver Tree
@andy-t-sp
Copy link

For anybody else reading this because they have broken mermaid diagrams in their docs. Version 0.8.1 contains a fix https://github.com/mgaitan/sphinxcontrib-mermaid/releases/tag/0.8.1.

For me, fixing was as simple as editing my requrements.txt file, amending the sphinxcontrib-mermaid line to:

sphinxcontrib-mermaid==0.8.1

then running pip install -r requirements.txt in the terminal and then re-building the docs.

@samonzeweb
Copy link

@andy-t-sp
Copy link

The 0.8.1 seems to use the old asset url : https://github.com/mgaitan/sphinxcontrib-mermaid/blob/0.8.1/sphinxcontrib/mermaid.py#L386

My (limited) understanding is that mermaid v9.x is still available at the old asset URL, it's just the new v10 version that is not. So, by specifying mermaid v9.4.1, the 0.8.1 release of sphinxcontrib-mermaid, does fix the issue. Diff here

Disclaimer: I'm just a dev with some broken docs trying to sort out a sensible fix, not a maintainer, expert, or authority on the subject.

@brownsarahm
Copy link
Author

updating the version will fix your docs, but it leaves you stuck on an old version of mermaid. I'm hoping the maintainer of this package will accept #111 because it's not ideal to be relying on an old version of mermaid.

@andy-t-sp
Copy link

andy-t-sp commented Mar 2, 2023

Thanks, so for me, perhaps amending my requirements.txt sphinxcontrib-mermaid line to:

sphinxcontrib-mermaid > 0.7.1, < 1.0

would be best? Then I'll get working docs for now, and if/when a better fix comes in from your PR or elsewhere, then I'll get that as well.

I'm specifying the version to less than v1, because, as we've seen with mermaid, major version number changes are likely to be breaking changes, assuming the author follows the semantic versioning convention.

bilderbuchi added a commit to pymeasure/leco-protocol that referenced this issue Mar 3, 2023
Fixes a bug because the underlying Mermaid had a breaking 
release. See mgaitan/sphinxcontrib-mermaid#110
@brownsarahm
Copy link
Author

No, fixing the version of this package probably wont fix the underlying issue, other than version 0.8.1 this package default to the "latest" version of mermaid, which to be clear, is the correct thing to do. We should use an intermediate package that fixes us to an old version of mermaid. You can either update to the latest version of this package which fixes you to an old version of mermaid, or like I did, manually modify this package to follow mermaid instructions.

You could even do as I did and point to my fork of this package.

Mermaid did not actually release breaking changes to their package. They changed how to access their code, the CDN.

g-bougard added a commit to glpi-project/doc-agent that referenced this issue Mar 7, 2023
@mgaitan
Copy link
Owner

mgaitan commented Mar 17, 2023

I'm closing this as (partially) fixed by 0.8.1 version .

This was a consequence a (IMHO very bad) decition from Mermaid developer. Now they are reconsidering it and probably we'll be able to support mermaid >10 by default soon. mermaid-js/mermaid#4148

@mgaitan mgaitan closed this as completed Mar 17, 2023
fajpunk added a commit to lsst-sqre/documenteer that referenced this issue Oct 15, 2024
* Set a lower bound on sphinxcontrib-mermaid to <=1
* Revert the Sphinx pin because this fixes the compatibility issue
* Ditch the `mermaid_version` pin because this fixes
mgaitan/sphinxcontrib-mermaid#110
fajpunk added a commit to lsst-sqre/documenteer that referenced this issue Oct 15, 2024
* Set a lower bound on sphinxcontrib-mermaid to <=1
* Revert the Sphinx pin because this fixes the compatibility issue
* Ditch the `mermaid_version` pin because this fixes
mgaitan/sphinxcontrib-mermaid#110
fajpunk added a commit to lsst-sqre/documenteer that referenced this issue Oct 15, 2024
* Set a lower bound on sphinxcontrib-mermaid to <=1
* Revert the Sphinx pin because this fixes the compatibility issue
* Ditch the `mermaid_version` pin because this fixes
mgaitan/sphinxcontrib-mermaid#110
fajpunk added a commit to lsst-sqre/documenteer that referenced this issue Oct 15, 2024
* Set a lower bound on sphinxcontrib-mermaid to <=1
* Revert the Sphinx pin because this fixes the compatibility issue
* Ditch the `mermaid_version` pin because this fixes
mgaitan/sphinxcontrib-mermaid#110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants