29 lines
853 B
HTML
29 lines
853 B
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<title>Mermaid test</title>
|
|
<link type="text/css" rel="stylesheet" href="/index.css" />
|
|
|
|
<script type="module" defer>
|
|
// import mermaid from './mermaid.mjs';
|
|
import mermaid from "https://unpkg.com/mermaid@9.2.2/dist/mermaid.esm.mjs";
|
|
mermaid.mermaidAPI.initialize({ startOnLoad: false });
|
|
// Example of using the API var
|
|
const element = document.querySelector("#graphDiv");
|
|
const insertSvg = function (svgCode, bindFunctions) {
|
|
element.innerHTML = svgCode;
|
|
};
|
|
const graphDefinition = "graph TB\na-->b";
|
|
const graph = await mermaid.mermaidAPI.render(
|
|
"graphDiv",
|
|
graphDefinition,
|
|
insertSvg
|
|
);
|
|
const div = document.createElement("div");
|
|
div.innerHTML = graph;
|
|
document.body.append(div);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="graphDiv"></div>
|
|
</body>
|