Skip to content

Commit 2c94d28

Browse files
committed
[config] Add mathjax
1 parent c0c41e6 commit 2c94d28

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ markup:
2525
# noClasses: false # This forces Hugo to inject the colors directly (easier for you)
2626

2727
params:
28+
math: true
2829
mainSections:
2930
- post
3031

themes/bw-minimal/layouts/_default/baseof.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
<link href='{{ "css/blog.css" | relURL }}' rel='stylesheet'/>
1414
<link href='{{ "css/trac.css" | relURL }}' rel='stylesheet'/>
1515

16+
{{ if .Param "math" }}
17+
{{ partial "math.html" . }}
18+
{{ end }}
19+
1620
</head>
1721
<body>
1822
<div class='content'>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/katex.min.css"
2+
integrity="sha384-WcoG4HRXMzYzfCgiyfrySxx90XSl2rxY5mnVY5TwtWE6KLrArNKn0T/mOgNL0Mmi" crossorigin="anonymous">
3+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/katex.min.js"
4+
integrity="sha384-J+9dG2KMoiR9hqcFao0IBLwxt6zpcyN68IgwzsCSkbreXUjmNVRhPFTssqdSGjwQ" crossorigin="anonymous">
5+
</script>
6+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/contrib/auto-render.min.js"
7+
integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"
8+
onload="renderMathInElement(document.body);">
9+
</script>
10+
<script>
11+
document.addEventListener("DOMContentLoaded", function () {
12+
renderMathInElement(document.body, {
13+
delimiters: [
14+
{ left: '\\[', right: '\\]', display: true }, // block
15+
{ left: '$$', right: '$$', display: true }, // block
16+
{ left: '\\(', right: '\\)', display: false }, // inline
17+
],
18+
throwOnError: false
19+
});
20+
});
21+
</script>

themes/bw-minimal/layouts/partials/mathjax.html

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)