mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
🐛 fix: Preserve Mermaid indentation disrupted by Hugo minify (#2069)
Add a pre tag to the Mermaid class to preserve indentation and ensure data retrieval on DOMContentLoaded
This commit is contained in:
+12
-1
@@ -2,6 +2,17 @@ function css(name) {
|
|||||||
return "rgb(" + getComputedStyle(document.documentElement).getPropertyValue(name) + ")";
|
return "rgb(" + getComputedStyle(document.documentElement).getPropertyValue(name) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const mermaidDivs = document.querySelectorAll("div.mermaid");
|
||||||
|
|
||||||
|
for (const div of mermaidDivs) {
|
||||||
|
const preElement = div.querySelector("pre");
|
||||||
|
if (preElement) {
|
||||||
|
div.textContent = preElement.textContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: "base",
|
theme: "base",
|
||||||
themeVariables: {
|
themeVariables: {
|
||||||
@@ -17,4 +28,4 @@ mermaid.initialize({
|
|||||||
"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif",
|
"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif",
|
||||||
fontSize: "16px",
|
fontSize: "16px",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<div class="mermaid" align="center">
|
<div class="mermaid" align="center">
|
||||||
{{ .Inner }}
|
<pre>{{ .Inner | safeHTML }}</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user