diff options
| author | Nikita Shubin <nikita.shubin@maquefel.me> | 2026-05-19 14:49:51 +0300 |
|---|---|---|
| committer | Nikita Shubin <nikita.shubin@maquefel.me> | 2026-05-19 14:49:51 +0300 |
| commit | f7bc1a7d9f241fa93a851eb3e456cd038c1b33ad (patch) | |
| tree | 849139bf86abe919a40ae60f264fdd9d5baed2bc | |
| parent | a341441f6a1ff904ecfdd0fc95029bce1ba53803 (diff) | |
| download | landau-suite-f7bc1a7d9f241fa93a851eb3e456cd038c1b33ad.tar.gz landau-suite-f7bc1a7d9f241fa93a851eb3e456cd038c1b33ad.zip | |
misc: Add support for mermaid themes
Done in a strait ugly way, becouse hugo refuses to respect
render-codeblock-mermaid.html or even render-codeblock.html.
So all done in js.
TODO: This issue should be addressed.
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
| -rw-r--r-- | template/layouts/partials/head-additions.html | 26 | ||||
| m--------- | template/themes/landau-hacker | 0 |
2 files changed, 26 insertions, 0 deletions
diff --git a/template/layouts/partials/head-additions.html b/template/layouts/partials/head-additions.html new file mode 100644 index 0000000..0aa1935 --- /dev/null +++ b/template/layouts/partials/head-additions.html @@ -0,0 +1,26 @@ +<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script> +<script> + document.addEventListener('DOMContentLoaded', function() { + // Look for mermaid code blocks + const mermaidBlocks = document.querySelectorAll('pre code.language-mermaid'); + if (mermaidBlocks.length > 0) { + mermaid.initialize({ + startOnLoad: false, + theme: 'default', + flowchart: { + useMaxWidth: true + } + }); + + mermaidBlocks.forEach((block, index) => { + const graphDefinition = block.textContent; + const div = document.createElement('div'); + div.className = 'mermaid'; + div.innerHTML = graphDefinition; + block.parentNode.parentNode.replaceChild(div, block.parentNode); + }); + + mermaid.init(); + } + }); +</script> diff --git a/template/themes/landau-hacker b/template/themes/landau-hacker -Subproject 1b9a1f570d7e90b84dca74ee1623101fb8f4332 +Subproject 075ee5aa6ba08c8b57040dd0f036156765620bf |
