This commit is contained in:
Oscar Plaisant
2024-03-28 23:40:47 +01:00
parent 32037ae8e7
commit e5ada772ca
3475 changed files with 1433 additions and 69 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

@@ -1,40 +0,0 @@
/*!
* 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;