🧜‍♀️ Add Mermaid integration for inline diagrams

This commit is contained in:
Jérôme Petazzoni
2024-11-18 19:01:06 -06:00
parent 6105b57914
commit 0d1873145e

View File

@@ -32,7 +32,19 @@
excludedClasses: [@@EXCLUDE@@]
});
</script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: false });
slideshow.on('afterShowSlide', function (slide) {
mermaid.run({
nodes: document.querySelectorAll('div.remark-visible .mermaid'),
});
});
// Reminder, if you want to tinker with mermaid,
// you need to export it, for instance like this:
// window.mermaid = mermaid;
</script>
<!--
These two scripts will be available only when loading the
content using the pub/sub server. Otherwise, they'll just