commit 30a68228b5484e723e6df36bb1a071a44712d622
parent a896142a54fde2c4b4a84e80bbcf375cb2bacca0
Author: Christian Ermann <christianermann@gmail.com>
Date: Tue, 30 Nov 2021 19:19:08 -0800
Added Latex support
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
@@ -3,4 +3,5 @@
<meta name="viewport" content="width=device-width">
<title>{{ .Page.Title }}</title>
<link rel="stylesheet" href="{{ "css/styles.css" | relURL }}">
+ {{ if .Params.math }}{{ partial "katex.html" . }}{{ end }}
</head>
diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html
@@ -0,0 +1,16 @@
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
+
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
+
+<script>
+ document.addEventListener("DOMContentLoaded", function() {
+ renderMathInElement(document.body, {
+ delimiters: [
+ { left: "$$", right: "$$", display: true },
+ { left: "$", right: "$", display: false }
+ ]
+ });
+ });
+</script>
+