Add mermaid for rendering graphs and other diagrams

This commit is contained in:
Lol3rrr
2026-02-21 02:33:24 +01:00
parent 01afd2dd1c
commit b09c8f455c
4 changed files with 2875 additions and 0 deletions

21
templates/_base.html Normal file
View File

@@ -0,0 +1,21 @@
{% extends "radion/templates/_base.html" %}
{% block scripts %}
{{ super() }}
<!-- mermaid -->
<!-- Based on the following blog -->
<!-- https://www.hahwul.com/dev/zola/mermaid-in-zola/ -->
<script src="/js/mermaid.min.js"></script>
<script type="module">
mermaid.initialize({ startOnLoad: false, theme: 'dark' });
document.addEventListener('DOMContentLoaded', async () => {
const mermaidElements = document.querySelectorAll('.mermaid');
if (mermaidElements.length > 0) {
await mermaid.run({
nodes: mermaidElements
});
}
});
</script>
{% endblock %}