dao-governance-framework/forum-network/public/mermaid-test.html

25 lines
831 B
HTML
Raw Normal View History

2022-11-13 12:23:30 -06:00
<!DOCTYPE html>
<head>
<title>Forum Network</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>
2022-11-13 12:23:30 -06:00
</head>
<body>
<div id="graphDiv"></div>
2022-11-13 12:23:30 -06:00
</body>