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

github.com/ribice/kiss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Cockburn <gergnz@gmail.com>2022-04-16 14:39:03 +0300
committerGitHub <noreply@github.com>2022-04-16 14:39:03 +0300
commit49e3fb8ea32449d248e20846e82a9cc800ab0d46 (patch)
treeb0fe86db1ee01667b72b1d0e88a7cbb5fc90d8b3
parentb64e2162fc041e452d0c4992c0a8797f9e3be823 (diff)
parent35dce884ad0cda3dc47aa5e2c4f5377ac3e3451c (diff)
Merge branch 'ribice:master' into master
-rw-r--r--README.md3
-rw-r--r--exampleSite/config.toml3
-rw-r--r--layouts/partials/gfonts.html10
-rw-r--r--layouts/partials/header.html8
-rw-r--r--layouts/partials/math.html46
5 files changed, 69 insertions, 1 deletions
diff --git a/README.md b/README.md
index 44a888a..64468f6 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,7 @@ authorEmail = "ribice@gmail.com" # Author email
[params.assets]
customCSS = ["css/custom.css"]
+googleFonts = []
[params.info]
adsense = "" # Adsense ID (ID only, without ca-pub-)
@@ -57,6 +58,8 @@ taxonomiesCount = true # Add taxonomies count
[params.features]
disqusOnDemand = true # Load Disqus comments on click
+mathjax = false
+katex = false
[params.opengraph.facebook]
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 5e01845..202a935 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -15,6 +15,7 @@ authorEmail = "ribice@gmail.com" # Author email
[params.assets]
customCSS = ["css/custom.css"]
+googleFonts = []
[params.info]
adsense = "" # Adsense ID (ID only, without ca-pub-)
@@ -27,6 +28,8 @@ taxonomiesCount = true # Add taxonomies count
[params.features]
disqusOnDemand = true # Load Disqus comments on click
+mathjax = false
+katex = false
[params.opengraph.facebook]
diff --git a/layouts/partials/gfonts.html b/layouts/partials/gfonts.html
new file mode 100644
index 0000000..c86e33f
--- /dev/null
+++ b/layouts/partials/gfonts.html
@@ -0,0 +1,10 @@
+<link rel="preconnect" href="https://fonts.gstatic.com" />
+<link
+ href="https://fonts.googleapis.com/css2?family=
+{{- range $index, $font := .Site.Params.Assets.googleFonts -}}
+ {{- if $index -}}&family={{- end -}}
+ {{ $font }}
+{{- end -}}
+&display=swap"
+ rel="stylesheet"
+/>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index f4861b1..5d6277b 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -18,6 +18,12 @@
{{- range .Site.Params.Assets.customCSS -}}
<link rel='stylesheet' href='{{ . | absURL }}'>
{{- end -}}
+{{ if or .Site.Params.Features.mathjax .Params.mathjax .Site.Params.Features.katex .Params.katex }}
+{{- partial "math" . -}}
+{{ end }}
+{{ if .Site.Params.Assets.googleFonts }}
+{{- partial "gfonts" . -}}
+{{ end }}
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
@@ -27,4 +33,4 @@
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
</head>
-<body> \ No newline at end of file
+<body>
diff --git a/layouts/partials/math.html b/layouts/partials/math.html
new file mode 100644
index 0000000..c60f3a7
--- /dev/null
+++ b/layouts/partials/math.html
@@ -0,0 +1,46 @@
+{{ if or .Site.Params.Features.mathjax .Params.mathjax }}
+<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+<script
+ id="MathJax-script"
+ async
+ src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
+></script>
+<script>
+ MathJax = {
+ tex: {
+ inlineMath: [["$", "$"]],
+ },
+ };
+</script>
+{{ end }}
+
+{{ if or .Site.Params.Features.katex .Params.katex }}
+<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"
+></script>
+<script>
+ document.addEventListener("DOMContentLoaded", function() {
+ renderMathInElement(document.body, {
+ delimiters: [
+ { left: "$$", right: "$$", display: true },
+ { left: "$", right: "$", display: false },
+ ],
+ });
+ });
+</script>
+{{ end }}