starters(blog): enable Hugo v0.122 native math passthrough by default

Requires Hugo v0.122.0+
This commit is contained in:
George Cushen 2024-01-28 18:40:00 +00:00
commit 728baf9dc0
5 changed files with 14 additions and 27 deletions

View file

@ -1,7 +1,7 @@
name: Deploy website to GitHub Pages
env:
WC_HUGO_VERSION: '0.119.0'
WC_HUGO_VERSION: '0.122.0'
on:
# Trigger the workflow every time you push to the `main` branch

View file

@ -3,7 +3,7 @@
# Hugo Documentation: https://gohugo.io/getting-started/configuration/#all-configuration-settings
# This file is formatted using YAML syntax - learn more at https://learnxinyminutes.com/docs/yaml/
title: Creator's Blog (Hugo Theme) # Website name
title: "Creator's Blog (Hugo Theme)" # Website name
baseURL: 'https://example.com/' # Website URL
############################
@ -70,11 +70,6 @@ taxonomies:
author: authors
markup:
_merge: deep
highlight:
codeFences: true
noHl: false
noClasses: false
lineNos: false
related:
threshold: 80
includeNewer: true
@ -88,3 +83,5 @@ security:
_merge: deep
sitemap:
_merge: deep
minify:
_merge: deep

View file

@ -1,7 +1,5 @@
# Navigation Links
# To link a homepage widget, specify the URL as a hash `#` followed by the filename of the
# desired widget in your `content/home/` folder.
# The weight parameter defines the order that the links will appear in.
# The weight parameter defines the order that the links will appear in.
main:
- name: Home

View file

@ -67,52 +67,44 @@ renders as
## Math
Hugo Blox Builder supports a Markdown extension for $\LaTeX$ math. You can enable this feature by toggling the `math` option in your `config/_default/params.yaml` file.
Hugo Blox Builder supports a Markdown extension for $\LaTeX$ math. Enable math by setting the `math: true` option in your page's front matter, or enable math for your entire site by toggling math in your `config/_default/params.yaml` file:
To render _inline_ or _block_ math, wrap your LaTeX math with `{{</* math */>}}$...${{</* /math */>}}` or `{{</* math */>}}$$...$${{</* /math */>}}`, respectively.
```yaml
features:
math:
enable: true
```
{{% callout note %}}
We wrap the LaTeX math in the Hugo Blox _math_ shortcode to prevent Hugo rendering our math as Markdown.
{{% /callout %}}
To render _inline_ or _block_ math, wrap your LaTeX math with `$...$` or `$$...$$`, respectively.
Example **math block**:
```latex
{{</* math */>}}
$$
\gamma_{n} = \frac{ \left | \left (\mathbf x_{n} - \mathbf x_{n-1} \right )^T \left [\nabla F (\mathbf x_{n}) - \nabla F (\mathbf x_{n-1}) \right ] \right |}{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2}
$$
{{</* /math */>}}
```
renders as
{{< math >}}
$$\gamma_{n} = \frac{ \left | \left (\mathbf x_{n} - \mathbf x_{n-1} \right )^T \left [\nabla F (\mathbf x_{n}) - \nabla F (\mathbf x_{n-1}) \right ] \right |}{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2}$$
{{< /math >}}
Example **inline math** `{{</* math */>}}$\nabla F(\mathbf{x}_{n})${{</* /math */>}}` renders as {{< math >}}$\nabla F(\mathbf{x}_{n})${{< /math >}}.
Example **inline math** `$\nabla F(\mathbf{x}_{n})$` renders as $\nabla F(\mathbf{x}_{n})$.
Example **multi-line math** using the math linebreak (`\\`):
```latex
{{</* math */>}}
$$f(k;p_{0}^{*}) = \begin{cases}p_{0}^{*} & \text{if }k=1, \\
1-p_{0}^{*} & \text{if }k=0.\end{cases}$$
{{</* /math */>}}
```
renders as
{{< math >}}
$$
f(k;p_{0}^{*}) = \begin{cases}p_{0}^{*} & \text{if }k=1, \\
1-p_{0}^{*} & \text{if }k=0.\end{cases}
$$
{{< /math >}}
## Code
Hugo Blox Builder utilises Hugo's Markdown extension for highlighting code syntax. The code theme can be selected in the `config/_default/params.yaml` file.

View file

@ -3,7 +3,7 @@
publish = "public"
[build.environment]
HUGO_VERSION = "0.121.1"
HUGO_VERSION = "0.122.0"
GO_VERSION = "1.21.5"
NODE_VERSION = "21.1.0"
HUGO_ENABLEGITINFO = "true"