Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xianmin/hugo-theme-jane.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Xianmin <xianmin12@gmail.com>2019-08-27 11:24:11 +0300
committerChen Xianmin <xianmin12@gmail.com>2019-08-27 11:24:11 +0300
commitbbbe31b348cc1965000c288c115be7903dd69212 (patch)
treeac9e7a9cb2e72820d774a4540009b59d017cdb85
parentfac2787ca38a23ec50beea40ba5c6380e51ca736 (diff)
feat: support KaTex
see https://github.com/KaTeX/KaTeX
-rw-r--r--exampleSite/full-config.toml3
-rw-r--r--layouts/partials/scripts.html31
2 files changed, 33 insertions, 1 deletions
diff --git a/exampleSite/full-config.toml b/exampleSite/full-config.toml
index ebdaf6e..2ee8fb7 100644
--- a/exampleSite/full-config.toml
+++ b/exampleSite/full-config.toml
@@ -101,6 +101,7 @@ defaultContentLanguage = "en" # Default language to use
photoswipe = true # see https://github.com/dimsemenov/PhotoSwipe # 是否启用PhotoSwipe(图片可点击)
bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN])
mathjax = false # see https://www.mathjax.org/ # 是否使用mathjax(数学公式)
+ katex = false # see https://github.com/KaTeX/KaTeX
contentCopyright = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>'
changyanAppid = "" # Changyan app id # 畅言
@@ -156,7 +157,7 @@ defaultContentLanguage = "en" # Default language to use
appKey = ''
notify = false # If you are using valine-admin(https://github.com/DesertsP/Valine-Admin) to notify users, do NOT enable this.
verify = false # Verification code
- avatar = 'mm'
+ avatar = 'mm'
placeholder = ''
[params.search.google] # google custom search, see https://cse.google.com
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 9a48691..a590edd 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -16,6 +16,7 @@
<script type="text/javascript" src="{{ $secureJS.RelPermalink }}" integrity="{{ $secureJS.Data.Integrity }}" crossorigin="anonymous"></script>
<!-- End -->
+<!-- Mathjax -->
{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/javascript">
window.MathJax = {
@@ -25,6 +26,36 @@
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML' async></script>
{{- end }}
+<!-- End -->
+
+<!-- KaTeX -->
+{{- if and (or .Params.katex (and .Site.Params.katex (ne .Params.katex false))) (or .IsPage .IsHome) }}
+ <link rel="stylesheet"
+ href="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/katex.min.css"
+ integrity="sha384-BdGj8xC2eZkQaxoQ8nSLefg4AV4/AwB3Fj+8SUSo7pnKP6Eoy18liIKTPn9oBYNG"
+ crossorigin="anonymous">
+
+ <!-- The loading of KaTeX is deferred to speed up page rendering -->
+ <script defer
+ src="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/katex.min.js"
+ integrity="sha384-JiKN5O8x9Hhs/UE5cT5AAJqieYlOZbGT3CHws/y97o3ty4R7/O5poG9F3JoiOYw1"
+ crossorigin="anonymous"></script>
+
+ <!-- To automatically render math in text elements, include the auto-render extension: -->
+ <script defer
+ src="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/contrib/auto-render.min.js"
+ integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI"
+ crossorigin="anonymous" onload="renderMathInElement(document.body);">
+ </script>
+ <script>
+ document.addEventListener("DOMContentLoaded", function() {
+ renderMathInElement(document.body, {
+ // ...options...
+ });
+ });
+ </script>
+{{- end }}
+<!-- End -->
{{- with .Site.Params.tencent_analytics -}}
<script id="tencent_analytics">