device-56.home 2026-3-29:22:14:22

This commit is contained in:
oskar
2026-03-29 22:14:22 +02:00
parent 9b7ca323a2
commit 604e7b7c03
48 changed files with 634 additions and 260 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

@@ -4,16 +4,20 @@
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) {
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) {
@@ -30,8 +34,16 @@ const Plugin = {
insertSvg
);
} catch (error) {
console.error(error, { graphDefinition, el });
el.innerHTML = error.message;
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;
}
});
},