Open koutbo6 opened 3 years ago
Found the cause.
lazy loading of slide contents causes the dimensions to be off for mermaid, therefore improperly calculate them for slides not fully loaded yet.
I've written some code to invoke init and render the diagrams only if the content has been fully loaded:
https://gist.github.com/koutbo6/f78bca0e2e2789c9892df77eafa1b70f
Solution works great for all diagrams .. except flow charts.
The flowchart diagrams render well, except for the node labels. Text dimension seems way off.
Here is how I see the following diagram:
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
Messing a bit with directives, I can get some of the labels to appear:
%%{init: { 'logLevel': 'debug', 'theme': 'neutral' } }%%
graph TD;
%%{config: { 'fontFamily': 'Menlo', 'fontSize': 18, 'fontWeight': 400} }%%
A-->B;
A-->C;
B-->D;
C-->D;
Would appreciate any guidance
Thanks!
I'm experiencing the sane thing as @malmarz
The "boxes" are smaller than the text so they can't be used.
I still have this issue and could not fix it with the gist provided above. The slides are not even rendering for those slides.
I am using pandoc markdown to create the revealjs presentation with this command:
pandoc -f markdown -t revealjs test-mermaid.md --include-before before.html -o index.html
test-mermaid.md
with this file and <script src="https://cdn.jsdelivr.net/npm/mermaid@10.2.3/dist/mermaid.min.js"></script>
in before.html
resulting in the following index.html which does not render correctly: https://jsfiddle.net/uzsbc895/
Any help is appreciated! :)
The trick mentioned above does not work anymore for mermaid 10.x The fist mermaid.init call somehow already triggers for the other slides as well, but does not render them correctly.
As I need to use new diagrams like mindmap, I am somewhat lost here..
I bisect some releases and found that this is broken since 9.2.0 (which introduces mindmaps :( ) - latest version which works with the workaround is 9.1.7
I know have something like this:
mermaid.mermaidAPI.initialize({
startOnLoad:false,
securityLevel: 'loose',
lazyLoad: false,
});
Reveal.initialize();
const cb = function (event) { mermaid.init(event.currentSlide, '.present>.mermaid'); };
Reveal.addEventListener('ready', cb);
Reveal.addEventListener('slidechanged', cb);
which works better, but not well..
Describe the bug Managed to integrate mermaid into reveal4.10 and it renders perfectly. That is, until you hit the 4th slide.
For some reason, slides 1,2,3 render the diagrams and set their size correctly.
Starting from slide 4 and beyond, the diagrams render, but they get unusually small sizes that prohibit their display.
To Reproduce
Attached index.html in this gist reproduces the problem: https://gist.github.com/koutbo6/44777c84fff9fe559bdf984aa065fe4d
Expected behavior diagrams should render properly on slides 4 and beyond when using mermaid with revealjs
Desktop (please complete the following information):
Additional context Here is the devtools console output. I probed the diagrams on slide 2 (working) and slide 4 (rendering but invisible due to small size)
Thank you