-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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 diagrams do not render text nodes (empty foreignObject
)
#10526
Comments
I'm having the same issue and it was even working yesterday 🤷🏻♂️ |
Note: your codesandbox is not a repro and doesn't contain any Mermaid-related code. But I can reproduce on Stackblitz It worked on our website under |
Yhea i suppose that if you try to rebuild your current working website at this date, the diagrams will do not show any texts |
Indeed it's a bug in a transitive dependency that was released 1d ago. DOMPurify v3.1.7 breaks Mermaid. You can fix it by downgrading to v3.1.6 with package manager features, for example Yarn resolutions: "resolutions": {
"dompurify": "3.1.6"
}, I created issues here: |
Thank you very much, @slorber! Pinning dompurify to 3.1.6 worked for me 🥳 |
Np We can keep it open until we are able to make it work by default for all newly initialized sites. We are waiting for Mermaid's position to figure out what to do. Using yarn resolution works but we don't want to keep it this way forever, it's not good DX to have to ask users to do this. |
Mermaid pinned the deps in https://github.com/mermaid-js/mermaid/releases/tag/v10.9.2 And a v11 release with this pinning is also planned (but Docusaurus only upgrades to v11 in the upcoming minor so we have time to wait). The problem should be fixed for all Docusaurus sites <= v3.5 as long as they regenerate their lockfile or upgrade mermaid v10.x to latest. Let me know if that works for you and if we can close |
Yay, this works! 🥳 Thank you and thanks Mermaid team! 🤗 |
Mermaid pinned their dependencies — see issue [#10526](facebook/docusaurus#10526)
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Docusaurus 3.5.2 (but in my testings it's reproducible with many other, if not all, 3.x.x versions)
Mermaid diagrams are rendered with empty text nodes.
foreignObject
DOM nodes are empty.Reproducible on new.docusaurus.io: https://codesandbox.io/p/devbox/dawn-darkness-docusaurus?privacy=public
I'm in the process of upgrading to Docusaurus 3. Mermaid diagrams were working perfectly with Docusaurus v3.5.1 a few weeks ago. Today, they don't seem to work as expected with 3.5.x, and, weirdly enough, I can't have them work in any other 3.x.x version either, including versions that were previously rendering diagrams perfectly 🤔
Reproducible demo
https://codesandbox.io/p/devbox/dawn-darkness-docusaurus?privacy=public
Steps to reproduce
Create new project
Ensure mermaid theme is in the dependencies (
"@docusaurus/theme-mermaid": "3.5.2",
), and Mermaid is properly configured in docusaurus.config.js:Insert a basic Mermaid diagram in a Markdown file, for instance at the top of the "Congratulations!" page in CodeSandbox. For instance like in the following excerpt:
Notice how the page renders the diagram but without any text, and inspect the DOM to notice that
foreignObject
nodes are empty, while they should contain text elements in a diagram properly rendered.Expected behavior
Properly rendered diagram with text nodes
It shouldn't be a Mermaid syntax issue because our original diagram, working on Docusaurus 2.xx and on our live website, is also working on mermaid.live.
Actual behavior
Empty text nodes:
No error in the console (DevTools or server) 🤷
Your environment
repo/docu3upgrade
branch to see a non-working version of Mermaid, and to the main branch or on our live website (Docusaurus 2.x) to see it work 😄Self-service
The text was updated successfully, but these errors were encountered: