Closed jtsternberg closed 2 months ago
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 2 days.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Any issue will be ignored if you don't provide the following detailed information.
I reported this issue here: https://wordpress.org/support/topic/on-by-default-and-mermaid-option-not-working/
Describe the bug
The bug I found is that the mermaid option isn't currently working due to the fact that the
pre
tag has achild
code tag, and that seems to be throwingmermaid.js
off.Also, there is a JS error in the console related to the Clipboard JS functionality conflicting with the mermaid code blocks:
If I add my hack to remove the
code
tag (and put thelanguage-mermaid
class on the pre tag, it starts working (though there the JS errors, more on that in a bit):Here is my hack to remove the code tag, so you can see for yourself:
This hack is not a good final solution — it would be better to fix it at the source.
The JS error can be fixed by changing
var codeClass = pre[i].children[0].className;
tovar codeClass = pre[i].className === "mermaid" ? "language-mermaid" : pre[i].children[0].className;
(assuming the pre tag change is made).To reproduce
Steps to reproduce the behavior:
Add the following to a new post/page:
(remove the
\
-- that's needed to prevent breaking the code block on github)Syntax error in graph mermaid version 9.4.3
TypeError: codeClass.indexOf is not a function
Expected behavior
The mermaid charts should render correctly. And the JS error should not be present.
Server environment
User environment
Additional context
https://wordpress.org/support/topic/on-by-default-and-mermaid-option-not-working/