Skip to content

Commit

Permalink
starters(blog): enable Hugo v0.122 native math passthrough by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Splitter committed Jan 28, 2024
1 parent b2cd75e commit 411b501
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 3 additions & 6 deletions config/_default/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

############################
Expand Down Expand Up @@ -70,11 +70,6 @@ taxonomies:
author: authors
markup:
_merge: deep
highlight:
codeFences: true
noHl: false
noClasses: false
lineNos: false
related:
threshold: 80
includeNewer: true
Expand All @@ -88,3 +83,5 @@ security:
_merge: deep
sitemap:
_merge: deep
minify:
_merge: deep
4 changes: 1 addition & 3 deletions config/_default/menus.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 8 additions & 16 deletions content/post/teach-courses/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.19

require (
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20231125204555-f431a4a2c705
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.1.2-0.20231229233433-b290b27077b8
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.2.1-0.20240128183758-3fb9b2e11ab0
)
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 411b501

Please sign in to comment.