Compare commits

..

3 Commits

Author SHA1 Message Date
Floren Munteanu
a5a3a08dcf
Merge 368c20e935eb96e9a6a5998c5a2941b9416b286c into fe2271b60bd34476726447fd9361aee59eb2a92f 2024-12-09 17:53:00 +03:30
Xin
fe2271b60b
docs(showcase): add "Model Context Protocol Specification"
Some checks failed
Deploy Hugo site to Pages / build (push) Has been cancelled
Deploy Hugo site to Pages / deploy (push) Has been cancelled
2024-12-08 12:38:44 +00:00
Torbjørn Pedersen
bd34a5bad3
fix: rerender mermaid diagrams on theme change (#509)
Make mermaid render diagrams on manual toggle between themes, after initial page load
2024-12-08 12:29:28 +00:00
2 changed files with 32 additions and 2 deletions

View File

@ -12,6 +12,13 @@ Open source projects powered by Hextra
</p> </p>
{{< cards >}} {{< cards >}}
{{< card
link="https://github.com/modelcontextprotocol/specification"
title="Model Context Protocol Specification"
image="https://github.com/user-attachments/assets/1bb4f952-b8fc-43b5-9cbd-cd7213c2ba90"
imageStyle="object-fit:cover; aspect-ratio:16/9;"
>}}
{{< card {{< card
link="https://github.com/jonaspleyer/cellular_raza" link="https://github.com/jonaspleyer/cellular_raza"
title="cellular_raza" title="cellular_raza"
@ -84,7 +91,7 @@ Open source projects powered by Hextra
link="https://hoa.moe/" link="https://hoa.moe/"
title="HITSZ OpenAuto" title="HITSZ OpenAuto"
image="https://raw.githubusercontent.com/HITSZ-OpenAuto/hoa.moe/main/static/images/showcase-new.png" image="https://raw.githubusercontent.com/HITSZ-OpenAuto/hoa.moe/main/static/images/showcase-new.png"
imageStyle="object-fit:cover; aspect-ratio:16/9;" imageStyle="object-fit:cover; aspect-ratio:16/9;"
>}} >}}
{{< card {{< card

View File

@ -37,9 +37,32 @@
{{- $mermaidJS := resources.Get "lib/mermaid/mermaid.min.js" | fingerprint -}} {{- $mermaidJS := resources.Get "lib/mermaid/mermaid.min.js" | fingerprint -}}
<script defer src="{{ $mermaidJS.RelPermalink }}" integrity="{{ $mermaidJS.Data.Integrity }}"></script> <script defer src="{{ $mermaidJS.RelPermalink }}" integrity="{{ $mermaidJS.Data.Integrity }}"></script>
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", () => {
// Store original mermaid code for each diagram
document.querySelectorAll(".mermaid").forEach(el => {
el.dataset.original = el.innerHTML;
});
const theme = document.documentElement.classList.contains("dark") ? "dark" : "default"; const theme = document.documentElement.classList.contains("dark") ? "dark" : "default";
mermaid.initialize({ startOnLoad: true, theme: theme }); mermaid.initialize({ startOnLoad: true, theme: theme });
let timeout;
new MutationObserver(() => {
clearTimeout(timeout);
timeout = setTimeout(() => {
const theme = document.documentElement.classList.contains("dark") ? "dark" : "default";
document.querySelectorAll(".mermaid").forEach(el => {
// Reset to original content, preserving HTML
el.innerHTML = el.dataset.original;
el.removeAttribute("data-processed");
});
mermaid.initialize({ startOnLoad: true, theme: theme });
mermaid.init();
}, 150);
}).observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"]
});
}); });
</script> </script>
{{- end -}} {{- end -}}