1.1 KB47 lines
Blame
1<html>
2 <body>
3 <pre id="diagram" class="mermaid">
4graph TB
5 a --> b
6 a --> c
7 b --> d
8 c --> d
9 </pre>
10
11 <div id="d2"></div>
12
13 <script type="module">
14 import mermaid from '/mermaid.esm.mjs';
15 mermaid.parseError = function (err, hash) {
16 // console.error('Mermaid error: ', err);
17 };
18 mermaid.initialize({
19 // theme: 'forest',
20 startOnLoad: true,
21 logLevel: 0,
22 flowchart: {
23 // defaultRenderer: 'elk',
24 useMaxWidth: false,
25 htmlLabels: true,
26 },
27 gantt: {
28 useMaxWidth: false,
29 },
30 useMaxWidth: false,
31 });
32 function callback() {
33 alert('It worked');
34 }
35 mermaid.parseError = function (err, hash) {
36 console.error('In parse error:');
37 console.error(err);
38 };
39 const value = `graph TD\nHello --> World`;
40 const el = document.getElementById('d2');
41 const { svg } = await mermaid.render('d22', value);
42 console.log(svg);
43 el.innerHTML = svg;
44 </script>
45 </body>
46</html>
47