This commit is contained in:
oscar.plaisant@icloud.com
2023-10-23 23:30:51 +02:00
parent f5b9c3d02c
commit 03ecc4a65b
3433 changed files with 1756195 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
/*!
* reveal.js Mermaid plugin
*/
import mermaid from "mermaid";
mermaid.mermaidAPI.initialize({
// The node size will be calculated incorrectly if set `startOnLoad: start`,
// so we need to manually render.
startOnLoad: false,
});
const Plugin = {
id: "mermaid",
init: function (reveal) {
const mermaidEls = reveal.getRevealElement().querySelectorAll(".mermaid");
Array.from(mermaidEls).forEach(function (el) {
var insertSvg = function (svgCode, bindFunctions) {
el.innerHTML = svgCode;
};
var graphDefinition = el.textContent.trim();
try {
mermaid.mermaidAPI.render(
`mermaid-${Math.random().toString(36).substring(2)}`,
graphDefinition,
insertSvg
);
} catch (error) {
console.error(error, { graphDefinition, el });
el.innerHTML = error.message;
}
});
},
};
export default () => Plugin;