vault backup: 2023-04-16 20:30:09

This commit is contained in:
2023-04-16 20:30:09 +02:00
parent 2d4c2ca436
commit ce4c6ab3bc
317 changed files with 43817 additions and 104047 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,52 @@
/*!
* reveal.js Mermaid plugin
*/
import mermaid from "mermaid";
const Plugin = {
id: "mermaid",
init: function (reveal) {
let { ...mermaidConfig } = reveal.getConfig().mermaid || {};
mermaid.mermaidAPI.initialize({
// The node size will be calculated incorrectly if set `startOnLoad: start`,
// so we need to manually render.
startOnLoad: false,
...mermaidConfig,
});
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) {
let errorStr = "";
if (error?.str) {
// From mermaid 9.1.4, error.message does not exists anymore
errorStr = error.str;
}
if (error?.message) {
errorStr = error.message;
}
console.error(errorStr, { error, graphDefinition, el });
el.innerHTML = errorStr;
}
});
},
};
export default () => Plugin;