aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/custom_head.html12
-rw-r--r--layouts/partials/katex.html3
2 files changed, 15 insertions, 0 deletions
diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html
new file mode 100644
index 0000000..97c539e
--- /dev/null
+++ b/layouts/partials/custom_head.html
@@ -0,0 +1,12 @@
+{{ if .Params.math }}{{ partial "katex.html" . }}{{ end }}
+
+<script>
+ document.addEventListener("DOMContentLoaded", function() {
+ renderMathInElement(document.body, {
+ delimiters: [
+ {left: "$$", right: "$$", display: true},
+ {left: "$", right: "$", display: false}
+ ]
+ });
+ });
+</script> \ No newline at end of file
diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html
new file mode 100644
index 0000000..bc9fde0
--- /dev/null
+++ b/layouts/partials/katex.html
@@ -0,0 +1,3 @@
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css">
+<script defer src="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.js"></script>
+<script defer src="https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script> \ No newline at end of file