mermaid/cypress/platform/rerender.html

30 lines
953 B
HTML
Raw Normal View History

2024-03-23 11:39:02 +05:30
<!doctype html>
<html>
2022-09-05 01:00:47 +05:30
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Mermaid Quick Test Page</title>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
</head>
<body>
<div id="graph"></div>
2023-02-19 14:03:11 +05:30
<script type="module">
import mermaid from './mermaid.esm.mjs';
mermaid.initialize({ startOnLoad: false });
2022-09-05 01:00:47 +05:30
mermaid.mermaidAPI.initialize();
2023-02-19 14:03:11 +05:30
async function rerender(text) {
2022-10-05 14:08:53 +08:00
const graphText = `graph TD
A[${text}] -->|Get money| B(Go shopping)`;
2023-02-19 14:03:11 +05:30
const { svg } = await mermaid.mermaidAPI.render('id', graphText);
console.log('\x1b[35m%s\x1b[0m', '>> graph', svg);
document.getElementById('graph').innerHTML = svg;
2022-09-05 01:00:47 +05:30
}
2023-02-19 14:03:11 +05:30
window.rerender = rerender;
await rerender('XMas');
2022-09-05 01:00:47 +05:30
</script>
<button id="rerender" onclick="rerender('Saturday')">Rerender</button>
</body>
</html>