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

github.com/puresyntax71/hugo-theme-chunky-poster.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexampleSite/config.toml1
-rw-r--r--[-rwxr-xr-x]exampleSite/content/post/math-typesetting.md (renamed from exampleSite/content/post/math-typesetting.mmark)27
-rw-r--r--exampleSite/layouts/partials/foot.html24
-rw-r--r--exampleSite/layouts/partials/math.html4
-rw-r--r--layouts/_default/card.html2
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/post/single.html2
7 files changed, 47 insertions, 15 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index eda5ab2..257d29d 100755
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -32,6 +32,7 @@ author = "authors"
author = "Hugo Authors"
description = "Lorem ipsum dolor sit amet."
homepageImage = "/images/homepage-image.jpg"
+ dateFormat = "January 2, 2006"
share = true
showLanguageSwitcher = false
diff --git a/exampleSite/content/post/math-typesetting.mmark b/exampleSite/content/post/math-typesetting.md
index 23ddd92..9305dd7 100755..100644
--- a/exampleSite/content/post/math-typesetting.mmark
+++ b/exampleSite/content/post/math-typesetting.md
@@ -1,13 +1,12 @@
---
authors:
- - "Hugo Authors"
+ - Hugo Authors
title: Math Typesetting
date: 2019-03-08
description: A brief guide to setup KaTeX
-markup: mmark
math: true
images:
- - math-typesetting.jpg
+ - math-typesetting.jpg
---
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.
@@ -19,31 +18,35 @@ In this example we will be using [KaTeX](https://katex.org/)
- Within this partial reference the [Auto-render Extension](https://katex.org/docs/autorender.html) or host these scripts locally.
- Include the partial in your templates like so:
-```
+```bash
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
-```
+```
+
- To enable KaTex globally set the parameter `math` to `true` in a project's configuration
-- To enable KaTex on a per page basis include the parameter `math: true` in content files.
+- To enable KaTex on a per page basis include the parameter `math: true` in content files
**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)
+
{{< math.inline >}}
{{ if or .Page.Params.math .Site.Params.math }}
<!-- KaTeX -->
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.css" integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ" crossorigin="anonymous">
-<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.js" integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij" crossorigin="anonymous"></script>
-<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
{{ end }}
{{</ math.inline >}}
### Examples
-Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$
+{{< math.inline >}}
+<p>
+Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
+</p>
+{{</ math.inline >}}
Block math:
-
$$
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
$$
-
diff --git a/exampleSite/layouts/partials/foot.html b/exampleSite/layouts/partials/foot.html
new file mode 100644
index 0000000..6627b41
--- /dev/null
+++ b/exampleSite/layouts/partials/foot.html
@@ -0,0 +1,24 @@
+{{ with index .Site.Data "chunky-poster" }}
+ {{ range $vendor := .assets }}
+ {{ if $vendor.js }}
+ <script src="{{ print "dist/" $vendor.js | relURL }}"></script>
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+{{ if .Site.Params.prismJS.enable }}
+<script>
+ window.Prism = window.Prism || {};
+ window.Prism.manual = true;
+</script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"></script>
+{{ end }}
+
+{{ range .Site.Params.customJS -}}
+ <script src="{{ "js/" | relURL }}{{ . }}"></script>
+{{ end }}
+
+{{ if or .Params.math .Site.Params.math }}
+ {{ partial "math.html" . }}
+{{ end }}
diff --git a/exampleSite/layouts/partials/math.html b/exampleSite/layouts/partials/math.html
new file mode 100644
index 0000000..6bb6143
--- /dev/null
+++ b/exampleSite/layouts/partials/math.html
@@ -0,0 +1,4 @@
+<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.body);"></script>
diff --git a/layouts/_default/card.html b/layouts/_default/card.html
index 41b7c9c..db61feb 100644
--- a/layouts/_default/card.html
+++ b/layouts/_default/card.html
@@ -12,7 +12,7 @@
{{- end -}}
<div class="card-body">
<h4 class="card-title">{{ $page.Title }}</h4>
- <p class="card-text text-muted text-uppercase">{{ $page.Date.Format "January 2, 2006" }}</p>
+ <p class="card-text text-muted text-uppercase">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</p>
<div class="card-text">
{{ $page.Summary | htmlUnescape }}
</div>
diff --git a/layouts/index.html b/layouts/index.html
index e048e7c..168373e 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -34,7 +34,7 @@
{{- end -}}
</div>
<div class="col-lg-6 mb-3">
- <h5 class="created text-muted text-uppercase font-weight-bold">{{ $page.Date.Format "January 2, 2006" }}</h5>
+ <h5 class="created text-muted text-uppercase font-weight-bold">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</h5>
<h2><a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a></h2>
<div class="content">
diff --git a/layouts/post/single.html b/layouts/post/single.html
index e425da4..73ed53d 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -7,7 +7,7 @@
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="meta text-muted mb-3">
- <p class="created text-muted text-uppercase font-weight-bold mb-1">{{ $page.Date.Format "January 2, 2006" }}</p>
+ <p class="created text-muted text-uppercase font-weight-bold mb-1">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006") }}</p>
<span class="mr-2"><i class="fas fa-book-open mr-2"></i>{{ T "wordCount" $page.WordCount }}</span>
<span><i class="fas fa-clock mr-2"></i>{{ T "readingTime" $page.ReadingTime }}</span>
</div>