mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-01 14:46:41 +02:00
37 lines
1.1 KiB
HTML
37 lines
1.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Examples</title>
|
|
</head>
|
|
<body>
|
|
<script type="module">
|
|
import mermaid from './mermaid.esm.mjs';
|
|
import { diagramData } from './mermaid-examples.esm.mjs';
|
|
for (const d of diagramData) {
|
|
const div = document.createElement('div');
|
|
const h1 = document.createElement('h1');
|
|
h1.appendChild(document.createTextNode(d.name));
|
|
div.appendChild(h1);
|
|
div.appendChild(document.createTextNode(d.description));
|
|
for (const example of d.examples) {
|
|
const pre = document.createElement('pre');
|
|
pre.classList.add('mermaid');
|
|
pre.textContent = example.code;
|
|
div.appendChild(pre);
|
|
}
|
|
document.body.appendChild(div);
|
|
}
|
|
mermaid.initialize({
|
|
startOnLoad: false,
|
|
logLevel: 0,
|
|
});
|
|
await mermaid.run();
|
|
if (window.Cypress) {
|
|
window.rendered = true;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|