feat(article): add KaTeX support

This commit is contained in:
Jimmy Cai 2020-09-21 16:22:44 +02:00
parent 0cee4930e2
commit b14ca5d15b
No known key found for this signature in database
GPG Key ID: 3EA408E527F37B18
3 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,7 @@ DefaultContentLanguage = "en" # Theme i18n support
avatar = "img/avatar.png"
subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
[params.article]
math = false
[params.article.license]
enabled = true
default = "Licenced under CC BY-NC-SA 4.0"

View File

@ -4,4 +4,8 @@
{{ partial "article/components/content" . }}
{{ partial "article/components/footer" . }}
{{ if or .Params.math .Site.Params.article.math }}
{{ partialCached "article/components/math.html" . }}
{{ end }}
</article>

View File

@ -0,0 +1,8 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"
integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"
integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"
integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
onload="renderMathInElement(document.querySelector(`.article-content`));"></script>