-
Notifications
You must be signed in to change notification settings - Fork 302
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
Multiple bytemd invocations on page confuse mermaid plugin. #4
Comments
kefahi
changed the title
Multiple bytemd invokations on page confuse mermaid plugin.
Multiple bytemd invocations on page confuse mermaid plugin.
Sep 2, 2020
Sounds great. PRs welcome! |
How about using timestamp? |
kefahi
added a commit
to kefahi/bytemd
that referenced
this issue
Sep 2, 2020
This is a fix for issue pd4d10#4
Sounds even better. PR is done and passed testing. Thanks! |
pd4d10
pushed a commit
that referenced
this issue
Sep 2, 2020
* Randomize the id of mermaid div This is a fix for issue #4 * Update index.ts
Thanks! @bytemd/plugin-mermaid v0.1.1 published |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I have a CMS engine, that lists posts with bytemd and mermaid plugin.
Bytemd uses div with a fixed id
bytemd-mermaid-${i}
where i is the ordinal of mermaid within that bytemd block.The problem is when there are multiple bytemd-based posts on the same html page they are given the same (conflicting) sequence of div ids. which causes the rendering of mermaid drawings to be badly broken.
My initial fix was to add randomizatoin to that div id as follows
bytemd-mermaid-${Math.floor(Math.random()*1000)}-${i}
The problem was solved for me this way; but not sure if this is the best solution; if so would you please consider as a fix and accept the change?
Thanks.
The text was updated successfully, but these errors were encountered: