2023-08-09 13:21:24 +05:30
|
|
|
<!--Do not edit this file-->
|
|
|
|
<!--Duplicate this file to any name you like, run `pnpm dev`, open http://localhost:9000/dev/name.html to view-->
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Mermaid development page</title>
|
2023-09-18 23:29:27 +05:30
|
|
|
<style>
|
|
|
|
.container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
}
|
|
|
|
|
|
|
|
#code {
|
|
|
|
max-width: 30vw;
|
|
|
|
width: 30vw;
|
|
|
|
}
|
|
|
|
|
|
|
|
#dynamicDiagram {
|
2023-09-18 23:31:23 +05:30
|
|
|
padding-left: 2em;
|
2023-09-18 23:29:27 +05:30
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
</style>
|
2023-08-09 13:21:24 +05:30
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="diagram" class="mermaid">
|
|
|
|
graph TB
|
|
|
|
a --> b
|
|
|
|
a --> c
|
|
|
|
b --> d
|
|
|
|
c --> d
|
|
|
|
</pre>
|
|
|
|
|
2023-09-18 23:29:27 +05:30
|
|
|
<hr />
|
|
|
|
Type code to view diagram:
|
|
|
|
<div class="container">
|
|
|
|
<textarea name="code" id="code" cols="30" rows="10"></textarea>
|
|
|
|
<div id="dynamicDiagram"></div>
|
|
|
|
</div>
|
|
|
|
<pre class="mermaid">info</pre>
|
2023-08-09 13:21:24 +05:30
|
|
|
|
|
|
|
<script type="module">
|
|
|
|
import mermaid from '/mermaid.esm.mjs';
|
2024-03-23 15:07:21 +05:30
|
|
|
import flowchartELK from '/mermaid-flowchart-elk.esm.mjs';
|
|
|
|
await mermaid.registerExternalDiagrams([flowchartELK]);
|
2023-09-18 23:29:27 +05:30
|
|
|
async function render(str) {
|
|
|
|
const { svg } = await mermaid.render('dynamic', str);
|
|
|
|
document.getElementById('dynamicDiagram').innerHTML = svg;
|
|
|
|
}
|
|
|
|
const storeKey = window.location.pathname;
|
|
|
|
const code = localStorage.getItem(storeKey);
|
|
|
|
if (code) {
|
|
|
|
document.getElementById('code').value = code;
|
|
|
|
await render(code);
|
|
|
|
}
|
2023-08-09 13:21:24 +05:30
|
|
|
mermaid.initialize({
|
|
|
|
startOnLoad: true,
|
|
|
|
logLevel: 0,
|
|
|
|
});
|
2023-09-18 23:29:27 +05:30
|
|
|
document.getElementById('code').addEventListener('input', async (e) => {
|
|
|
|
const value = e.target.value;
|
|
|
|
localStorage.setItem(storeKey, value);
|
|
|
|
await render(value);
|
|
|
|
});
|
2023-08-09 13:21:24 +05:30
|
|
|
</script>
|
2023-08-13 18:51:02 +05:30
|
|
|
|
2023-08-17 14:30:47 +05:30
|
|
|
<script src="/dev/reload.js"></script>
|
2023-08-09 13:21:24 +05:30
|
|
|
</body>
|
|
|
|
</html>
|