增加数学支持
This commit is contained in:
7
layouts/partials/extend_head.html
Normal file
7
layouts/partials/extend_head.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{{- /* Head custom content area start */ -}}
|
||||||
|
{{- /* Insert any custom code (web-analytics, resources, etc.) - it will appear in the <head></head> section of every page. */ -}}
|
||||||
|
{{- /* Can be overwritten by partial with the same name in the global layouts. */ -}}
|
||||||
|
{{- /* Head custom content area end */ -}}
|
||||||
|
{{ if or .Params.math .Site.Params.math }}
|
||||||
|
{{ partial "math.html" . }}
|
||||||
|
{{ end }}
|
||||||
19
layouts/partials/math.html
Normal file
19
layouts/partials/math.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.28/dist/katex.min.css" integrity="sha384-Wsr4Nh3yrvMf2KCebJchRJoVo1gTU6kcP05uRSh5NV3sj9+a8IomuJoQzf3sMq4T" crossorigin="anonymous">
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.28/dist/katex.min.js" integrity="sha384-+W9OcrYK2/bD7BmUAk+xeFAyKp0QjyRQUCxeU31dfyTt/FrPsUgaBTLLkVf33qWt" crossorigin="anonymous"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.28/dist/contrib/auto-render.min.js" integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
renderMathInElement(document.body, {
|
||||||
|
// customised options
|
||||||
|
// • auto-render specific keys, e.g.:
|
||||||
|
delimiters: [
|
||||||
|
{left: '$$', right: '$$', display: true},
|
||||||
|
{left: '$', right: '$', display: false},
|
||||||
|
{left: '\\(', right: '\\)', display: false},
|
||||||
|
{left: '\\[', right: '\\]', display: true}
|
||||||
|
],
|
||||||
|
// • rendering keys, e.g.:
|
||||||
|
throwOnError : false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user