mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-26 20:41:37 +01:00
5d9d7786a2
Closes #7 , closes #9 The existing outdated Hugo documentation in this repo will be replaced with the following more-or-less *evergreen* content: - **Markdown & HTML Syntax Guide** shows whether a theme has decorated basic HTML elements with CSS. Note that I have not included the Markdown syntax for aligning table columns due to: https://github.com/russross/blackfriday/issues/506 - **Rich Content** features a brief showcase of Hugo’s Privacy config and related Simple shortcodes. Note that I have chosen to embed content that showcases typography by several designers in various media including a 360° interactive YouTube video (for inspiration). Also these embeds should be covered under [Fair Use](https://fairuse.stanford.edu/overview/fair-use/what-is-fair-use/) since these are meant for teaching users how these Hugo shortcodes work. - **Placeholder Content** includes dummy copy along with a diagram and a link with info about the *Van de Graaf Canon* for constructing layouts (that can also be applied to websites). Note: the diagram is Open Source and taken from https://en.wikipedia.org/wiki/Canons_of_page_construction#Van_de_Graaf_canon (there is a link to this page in the caption). - **Math Typesetting** a brief tutorial about enabling KaTeX in Hugo (the Hugo Docs mention MathJax which is slower) - **Emoji Support** brief tutorial about Hugo’s built-in Unicode emoji support (as mentioned in the Hugo Docs) but also this includes an original technique for enabling non Unicode emoji in Hugo by using Static Image Replacement with the `replaceRE` function. Note: custom icons are from the Open Source [Mutant Standard](https://mutant.tech) emoji set. Also note that the **About** Page has been expanded and updated to reflect Hugo’s current features. --- **NOTES** Besides quoting from the Hugo Docs (when needed), these content files contain original content written and curated by me and whatever sources I used were modified to such an extent that there is no need for footnotes. The author credit for the new content is Hugo Authors since this is meant for the Hugo community -of which I am a current member- furthermore the content also may be modified by someone else in the future, so this credit seems more appropriate than one with my name. P.S. @digitalcraftsman I have not included a guide about Modular Typography as this would have been quite involved and I am running out of time. P.S.2 This PR also fixes the path of the `menu.main` `/about/` item see: #41 by @guylyons
47 lines
1.8 KiB
Plaintext
47 lines
1.8 KiB
Plaintext
---
|
|
author: Hugo Authors
|
|
title: Math Typesetting
|
|
date: 2019-03-08
|
|
description: A brief guide to setup KaTeX
|
|
markup: mmark
|
|
math: true
|
|
---
|
|
|
|
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.
|
|
<!--more-->
|
|
|
|
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 }}
|
|
<!-- 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>
|
|
{{ end }}
|
|
{{</ math.inline >}}
|
|
|
|
### Examples
|
|
|
|
Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$
|
|
|
|
Block math:
|
|
|
|
$$
|
|
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
|
|
$$
|
|
|