mkdocs-material: Refreshing page will show Syntax error in mermaid graph sometimes
Contribution guidelines
- I’ve read the contribution guidelines and wholeheartedly agree
I’ve found a bug and checked that …
- … the problem doesn’t occur with the
mkdocs
orreadthedocs
themes - … the problem persists when all overrides are removed, i.e.
custom_dir
,extra_javascript
andextra_css
- … the documentation does not mention anything about my problem
- … there are no open or closed issues that are related to my problem
Description
Refreshing page will show Syntax error in mermaid graph sometimes. This shows in the Official Docs for me. Also, using mkdocs serve/build reproduces the same bug.
Expected behaviour
Always show the correctly rendered MermaidJS graph.
Actual behaviour
Sometimes normal, while sometimes not.
Refreshing page but with cache disabled can solve this problem…
Steps to reproduce
Just keep refreshing the page.
Package versions
Doesn’t matter.
Configuration
Doesn't matter.
System information
- Operating system: Mac OS / Windows.
- Browser: Chrome / Firefox
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (15 by maintainers)
Thanks for this discussion–it helped us diagnose a similar issue on the Kubernetes website. 🙇🏻
@Guts You are welcome. Glad it helped!
Thanks a lot @orenwang, this is exactly the problem that has been blocking us for a while: https://github.com/squidfunk/mkdocs-material/discussions/3056. Hurray, it’s finally fixed 🙏!
The fix was just released as part of 7.3.6-insiders-3.2.3.
I don’t think Mermaid runs async, but I do it the same way as I do MathJax which does use async 🤷🏻 :
I don’t know how much any of this info will help, but maybe there is something that stands out.
Potential fix in
f8b74c207
. My testing shows that this mitigates the issue. I’ll look into it again to search for a better solution when I find some time to refactor this part of the code. It’s really sad that Mermaid has such a bad API design.