From 226066dfa18b7c93ef14d32c86d74f2315751f1f Mon Sep 17 00:00:00 2001 From: puresyntax71 <34715246+puresyntax71@users.noreply.github.com> Date: Fri, 13 Nov 2020 11:56:09 +0800 Subject: Fixes #94. --- exampleSite/content/post/math-typesetting.md | 52 +++++++++++++++++++++++++ exampleSite/content/post/math-typesetting.mmark | 49 ----------------------- exampleSite/layouts/partials/foot.html | 24 ++++++++++++ exampleSite/layouts/partials/math.html | 4 ++ 4 files changed, 80 insertions(+), 49 deletions(-) create mode 100644 exampleSite/content/post/math-typesetting.md delete mode 100755 exampleSite/content/post/math-typesetting.mmark create mode 100644 exampleSite/layouts/partials/foot.html create mode 100644 exampleSite/layouts/partials/math.html diff --git a/exampleSite/content/post/math-typesetting.md b/exampleSite/content/post/math-typesetting.md new file mode 100644 index 0000000..9305dd7 --- /dev/null +++ b/exampleSite/content/post/math-typesetting.md @@ -0,0 +1,52 @@ +--- +authors: + - Hugo Authors +title: Math Typesetting +date: 2019-03-08 +description: A brief guide to setup KaTeX +math: true +images: + - math-typesetting.jpg +--- + +Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries. + + +In this example we will be using [KaTeX](https://katex.org/) + +- Create a partial under `/layouts/partials/math.html` +- 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 + +**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 }} + + + + +{{ end }} +{{}} + +### Examples + +{{< math.inline >}} +

+Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\) +

+{{}} + +Block math: +$$ + \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } +$$ diff --git a/exampleSite/content/post/math-typesetting.mmark b/exampleSite/content/post/math-typesetting.mmark deleted file mode 100755 index 23ddd92..0000000 --- a/exampleSite/content/post/math-typesetting.mmark +++ /dev/null @@ -1,49 +0,0 @@ ---- -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 ---- - -Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries. - - -In this example we will be using [KaTeX](https://katex.org/) - -- Create a partial under `/layouts/partials/math.html` -- 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: - -``` -{{ 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. - -**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 }} - - - - -{{ end }} -{{}} - -### Examples - -Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$ - -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 }} + + {{ end }} + {{ end }} +{{ end }} + +{{ if .Site.Params.prismJS.enable }} + + + +{{ end }} + +{{ range .Site.Params.customJS -}} + +{{ 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 @@ + + + -- cgit v1.2.3