mirror of
https://github.com/8butubb/8butubb.github.io.git
synced 2026-07-11 11:50:12 +00:00
1
This commit is contained in:
@@ -36,6 +36,29 @@
|
||||
|
||||
{{- partial "extend_footer.html" . }}
|
||||
|
||||
<script type="module">
|
||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
mermaid.initialize({ startOnLoad: true, theme: 'default' });
|
||||
document.querySelectorAll('.language-mermaid').forEach(function(block) {
|
||||
const container = block.closest('.highlight') || block.parentNode;
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.className = 'mermaid';
|
||||
// Some Markdown parsers will escape < > " & etc.
|
||||
// So we unescape them before sending to Mermaid
|
||||
const txt = document.createElement("textarea");
|
||||
txt.innerHTML = block.innerHTML;
|
||||
div.textContent = txt.value;
|
||||
|
||||
if (container) {
|
||||
container.parentNode.replaceChild(div, container);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
let menu = document.getElementById('menu');
|
||||
if (menu) {
|
||||
@@ -152,3 +175,5 @@
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user