Compare commits

..

15 Commits

Author SHA1 Message Date
05fd0129c2 fix(i18n): add missing tags translations (#708) 2025-06-15 10:29:43 +01:00
Xin
7031718449 feat(math): add optional MathJax support (#707)
* feat: add MathJax option

* docs: move math engine note

* refactor: update LaTeX documentation and improve MathJax integration

- Adjusted LaTeX documentation for clarity and formatting.
- Enhanced MathJax configuration in the templates to support both KaTeX and MathJax rendering.
- Removed deprecated comments and streamlined the script loading process for MathJax.
- Updated the passthrough extension settings in the Hugo configuration for better compatibility with LaTeX math expressions.

* docs: simplify LaTeX documentation and clarify configuration steps

- Updated LaTeX documentation to reflect that KaTeX is enabled by default, removing the need for manual activation.
- Added examples for using LaTeX math expressions and clarified the configuration for the passthrough extension in Hugo.
- Enhanced MathJax section to emphasize its use as an alternative rendering engine.
2025-06-14 14:36:10 +01:00
e22b8d5c0e feat(tags): improve usability of tags (#698)
* feat(tags): improve usability of tags

* Tags can be shown also at docs
* Documented tag-related config flags
* Added example tags to the site
* Made rendered tags active

* Move tags listing to ToC

* Hide tags section on no tags
2025-06-13 22:09:05 +01:00
Xin
32a55bb8ee fix(build): run npm update to fix postcss complaint 2025-06-13 21:57:08 +01:00
b43870a538 fix: wrong SRI hash for katex.css (#702)
* Correct URL given in 'dev.toml'

* stylesheet 'katex.css': fix SRI hash
2025-06-10 23:48:03 +01:00
9c2a9f600b chore: update tailwind css to latest version 4.1.8 (#703) 2025-06-10 23:46:53 +01:00
7385fe9e2a docs: document configure opengraph image (#706)
* [Docs] document using og:image

* Make example title page match others

* clarify wording
2025-06-10 23:45:19 +01:00
b1d40c4a2d fix: spacing between title and site title (#704) 2025-06-07 14:31:25 +01:00
Xin
40b1c5f2f1 docs: update hugo version in deploy guide (#699) 2025-06-04 00:38:38 +01:00
Xin
3a13d44d3c chore: update Hugo version to 0.147.7 and improve nav-menu script 2025-06-01 17:37:37 +01:00
Xin
c24d55ee40 feat: child menu support in navbar (#695)
* feat: implement child menu support in main navbar

- Added a new JavaScript file for handling dropdown functionality in the navbar.
- Implemented event listeners for toggling dropdowns, closing them on outside clicks, and dismissing with the Escape key.
- Updated navbar HTML to support dropdown items with children, enhancing the navigation experience.
- Adjusted core script imports to include the new dropdown functionality.

* chore: update menu identifiers and add missing translations for development versions

* chore: update hugo stats

* chore: update script name

* chore: update menu item names to include arrows for external links
2025-06-01 17:33:45 +01:00
a44de285b2 chore: adapt theme to new template system (#696)
* Adapted theme's layout to [Hugo v0.146.0](https://gohugo.io/templates/new-templatesystem-overview/)
* Bumped minimal Hugo version to v0.146.0
2025-06-01 00:25:39 +01:00
c8a231b650 fix(build): update NPM to resolve postcss issue (#694)
`npm update` fixed broken development which logged:

>  postcss: Error: Loading PostCSS Plugin failed: Cannot find module '../lightningcss.linux-x64-gnu.node
2025-05-31 22:38:43 +01:00
Xin
5a6fa55d0a fix: missing variables and custom styles css imports for theme dev 2025-05-31 19:58:09 +01:00
c497ef700e docs(chore): switch to new template system (Hugo v0.146.0) (#681) 2025-05-31 16:48:23 +01:00
136 changed files with 1220 additions and 444 deletions

View File

@ -3,7 +3,7 @@
"features": {
"ghcr.io/devcontainers/features/hugo:1": {
"extended": true,
"version": "0.145.0"
"version": "0.147.7"
},
"ghcr.io/devcontainers/features/node:1": {}
},
@ -18,5 +18,7 @@
}
},
"postCreateCommand": "npm install",
"forwardPorts": [1313]
}
"forwardPorts": [
1313
]
}

View File

@ -31,7 +31,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.145.0
HUGO_VERSION: 0.147.7
steps:
- name: Checkout
uses: actions/checkout@v4

File diff suppressed because one or more lines are too long

62
assets/js/nav-menu.js Normal file
View File

@ -0,0 +1,62 @@
(function () {
const hiddenClass = "hx:hidden";
const dropdownToggles = document.querySelectorAll(".hextra-nav-menu-toggle");
dropdownToggles.forEach((toggle) => {
toggle.addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
// Close all other dropdowns first
dropdownToggles.forEach((otherToggle) => {
if (otherToggle !== toggle) {
otherToggle.dataset.state = "closed";
const otherMenuItems = otherToggle.nextElementSibling;
otherMenuItems.classList.add(hiddenClass);
}
});
// Toggle current dropdown
const isOpen = toggle.dataset.state === "open";
toggle.dataset.state = isOpen ? "closed" : "open";
const menuItemsElement = toggle.nextElementSibling;
if (!isOpen) {
// Position dropdown centered with toggle
menuItemsElement.style.position = "absolute";
menuItemsElement.style.top = "100%";
menuItemsElement.style.left = "50%";
menuItemsElement.style.transform = "translateX(-50%)";
menuItemsElement.style.zIndex = "1000";
// Show dropdown
menuItemsElement.classList.remove(hiddenClass);
} else {
// Hide dropdown
menuItemsElement.classList.add(hiddenClass);
}
});
});
// Dismiss dropdown when clicking outside
document.addEventListener("click", (e) => {
if (e.target.closest(".hextra-nav-menu-toggle") === null) {
dropdownToggles.forEach((toggle) => {
toggle.dataset.state = "closed";
const menuItemsElement = toggle.nextElementSibling;
menuItemsElement.classList.add(hiddenClass);
});
}
});
// Close dropdowns on escape key
document.addEventListener("keydown", (e) => {
if (e.key === "Escape") {
dropdownToggles.forEach((toggle) => {
toggle.dataset.state = "closed";
const menuItemsElement = toggle.nextElementSibling;
menuItemsElement.classList.add(hiddenClass);
});
}
});
})();

View File

@ -1,5 +1,5 @@
# Theme development config for exampleSite
# https://gohugo.io/getting-started/configuration/#configure-cache-busters
# https://gohugo.io/configuration/build/#cache-busters
[build]
[build.buildStats]
enable = true

View File

@ -4,6 +4,10 @@ date: 2020-01-01
authors:
- name: John Doe
link: https://example.com/johndoe
tags:
- Markdown
- 示例
- 指南
excludeSearch: true
---

View File

@ -1,6 +1,9 @@
---
title: شروع کنید
weight: 1
tags:
- مستندات
- راهنما
next: /docs/guide
prev: /docs
---
@ -120,16 +123,7 @@ hugo mod get -u github.com/imfing/hextra
hugo new site my-site --format=yaml
```
### افزودن تم هگسترا به عنوان یک ساب‌ماژول Git
به دایرکتوری سایت بروید و یک مخزن Git جدید را مقداردهی اولیه کنید:
```shell
cd my-site
git init
```
سپس، تم هگسترا را به عنوان یک ساب‌ماژول Git اضافه کنید:
### افزودن تم هگزترا به عنوان یک ساب‌ماژول Git
```shell
git submodule add https://github.com/imfing/hextra.git themes/hextra

View File

@ -1,6 +1,9 @@
---
title: はじめに
weight: 1
tags:
- ドキュメント
- ガイド
next: /docs/guide
prev: /docs
---
@ -124,15 +127,6 @@ hugo new site my-site --format=yaml
### HextraテーマをGitサブモジュールとして追加
サイトディレクトリに移動し、新しいGitリポジトリを初期化します
```shell
cd my-site
git init
```
次に、HextraテーマをGitサブモジュールとして追加します
```shell
git submodule add https://github.com/imfing/hextra.git themes/hextra
```

View File

@ -1,6 +1,9 @@
---
title: Getting Started
weight: 1
tags:
- Docs
- Guide
next: /docs/guide
prev: /docs
---
@ -124,15 +127,6 @@ hugo new site my-site --format=yaml
### Add Hextra theme as a Git submodule
Switch to the site directory and initialize a new Git repository:
```shell
cd my-site
git init
```
Then, add Hextra theme as a Git submodule:
```shell
git submodule add https://github.com/imfing/hextra.git themes/hextra
```

View File

@ -1,6 +1,9 @@
---
title: 入门指南
weight: 1
tags:
- 文档
- 指南
next: /docs/guide
prev: /docs
---
@ -124,15 +127,6 @@ hugo new site my-site --format=yaml
### 将 Hextra 主题添加为 Git 子模块
切换到站点目录并初始化新的 Git 仓库:
```shell
cd my-site
git init
```
然后,将 Hextra 主题添加为 Git 子模块:
```shell
git submodule add https://github.com/imfing/hextra.git themes/hextra
```

View File

@ -212,6 +212,19 @@ params:
پارامتر `theme.displayToggle` به شما این امکان را می‌دهد که یک دکمه جابجایی برای تغییر حالت تم‌ها نمایش دهید.
وقتی روی `true` تنظیم شود، بازدیدکنندگان می‌توانند بین حالت روشن یا تیره جابه‌جا شوند و تنظیمات پیش‌فرض را نادیده بگیرند.
### برچسب‌ها
برای نمایش برچسب‌های صفحه، گزینه‌های زیر را در فایل پیکربندی تنظیم کنید:
```yaml {filename="hugo.yaml"}
params:
blog:
list:
displayTags: true
toc:
displayTags: true
```
### عرض صفحه
عرض صفحه را می‌توان با پارامتر `params.page.width` در پرونده پیکربندی سفارشی کرد:

View File

@ -212,6 +212,19 @@ params:
`theme.displayToggle`パラメータを使用して、テーマを変更するためのトグルボタンを表示できます。
`true`に設定すると、訪問者はデフォルト設定を上書きしてライトモードとダークモードを切り替えることができます。
### タグ
ページのタグを表示するには、設定ファイルで次のフラグを設定してください:
```yaml {filename="hugo.yaml"}
params:
blog:
list:
displayTags: true
toc:
displayTags: true
```
### ページ幅
ページの幅は、設定ファイルの`params.page.width`パラメータでカスタマイズできます:

View File

@ -1,6 +1,8 @@
---
title: Configuration
weight: 2
tags:
- Config
---
Hugo reads its configuration from `hugo.yaml` in the root of your Hugo site.
@ -228,6 +230,19 @@ params:
dateFormat: "January 2, 2006"
```
### Tags
To display page tags, set following flags in the config file:
```yaml {filename="hugo.yaml"}
params:
blog:
list:
displayTags: true
toc:
displayTags: true
```
### Page Width
The width of the page can be customized by the `params.page.width` parameter in the config file:
@ -319,3 +334,18 @@ To exclude an entire directory, use the [`cascade`](https://gohugo.io/configurat
> To block search crawlers, you can make a [`robots.txt` template](https://gohugo.io/templates/robots/).
> However, `robots.txt` instructions do not necessarily keep a page out of Google search results.
### Open Graph
To add [Open Graph](https://ogp.me/) metadata to a page, add values in the frontmatter params.
As a page can have multiple `image` and `video` tags, place their values in an array.
Other Open Graph properties can have only one value.
For example, this page has an `og:image` tag (which configures an image to preview on social shares) and an `og:audio` tag.
```yaml {filename="content/docs/guide/configuration.md"}
title: "Configuration"
params:
images:
- "/img/config-image.jpg"
audio: "config-talk.mp3"
```

View File

@ -212,6 +212,19 @@ params:
`theme.displayToggle` 参数允许您显示一个切换按钮以更改主题。
当设置为 `true` 时,访问者可以在浅色或深色模式之间切换,覆盖默认设置。
### 标签
要显示页面标签,请在配置文件中设置以下标志:
```yaml {filename="hugo.yaml"}
params:
blog:
list:
displayTags: true
toc:
displayTags: true
```
### 页面宽度
页面的宽度可以通过配置文件中的 `params.page.width` 参数进行自定义:

View File

@ -54,7 +54,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.145.0
HUGO_VERSION: 0.147.7
steps:
- name: Checkout
uses: actions/checkout@v4
@ -146,7 +146,7 @@ run: |
3. [hextra-starter-template][hextra-starter-template]を使用していない場合、以下の設定を手動で行います:
- ビルドコマンドを `hugo --gc --minify` に設定します。
- 公開ディレクトリを `public` に指定します。
- 環境変数 `HUGO_VERSION` を追加し、`0.145.0` に設定するか、`netlify.toml` ファイルに設定します。
- 環境変数 `HUGO_VERSION` を追加し、`0.147.7` に設定するか、`netlify.toml` ファイルに設定します。
4. デプロイします!
詳細については、[NetlifyでのHugo](https://docs.netlify.com/integrations/frameworks/hugo/)を確認してください。

View File

@ -54,7 +54,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.145.0
HUGO_VERSION: 0.147.7
steps:
- name: Checkout
uses: actions/checkout@v4
@ -146,7 +146,7 @@ For more details, check out:
3. If you are not using [hextra-starter-template][hextra-starter-template], configure the following manually:
- Configure the Build command to `hugo --gc --minify`
- Specify the Publish directory to `public`
- Add Environment variable `HUGO_VERSION` and set to `0.145.0`, or alternatively, set it in `netlify.toml` file
- Add Environment variable `HUGO_VERSION` and set to `0.147.7`, or alternatively, set it in `netlify.toml` file
4. Deploy!
Check [Hugo on Netlify](https://docs.netlify.com/integrations/frameworks/hugo/) for more details.

View File

@ -54,7 +54,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.145.0
HUGO_VERSION: 0.147.7
steps:
- name: 检出
uses: actions/checkout@v4
@ -146,7 +146,7 @@ run: |
3. 如果您没有使用 [hextra-starter-template][hextra-starter-template],请手动配置以下内容:
- 将构建命令配置为 `hugo --gc --minify`
- 指定发布目录为 `public`
- 添加环境变量 `HUGO_VERSION` 并设置为 `0.145.0`,或者将其设置在 `netlify.toml` 文件中
- 添加环境变量 `HUGO_VERSION` 并设置为 `0.147.7`,或者将其设置在 `netlify.toml` 文件中
4. 部署!
查看 [Netlify 上的 Hugo](https://docs.netlify.com/integrations/frameworks/hugo/) 了解更多详情。

View File

@ -1,22 +1,10 @@
---
title: "LaTeX"
weight: 4
math: true
---
\(\KaTeX\) برای رندر کردن عبارت‌های ریاضی LaTeX استفاده می‌شود. می‌توان آن را در هر صفحه با تنظیم `math` روی `true` در قسمت بالای صفحه فعال کرد.
<!--more-->
```yaml {filename="Markdown"}
---
title: "صفحه من با LaTeX"
math: true
---
```
وقتی فعال باشد، اسکریپت‌ها، شیوه‌نامه‌ها و فونت‌های KaTeX به طور خودکار در سایت شما قرار می‌گیرند. می‌توانید از عبارت‌های ریاضی LaTeX در محتوای مارک‌داون خود استفاده کنید.
به طور پیش‌فرض، \(\KaTeX\) برای رندر کردن عبارت‌های ریاضی LaTeX استفاده می‌شود.
نیازی به فعال‌سازی دستی نیست، می‌توانید فوراً از عبارت‌های ریاضی LaTeX در محتوای مارک‌داون خود استفاده کنید.
## مثال
@ -40,6 +28,46 @@ $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
$$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
به عنوان مثال، استفاده از محیط هم‌ترازی:
```latex {filename="page.md"}
$$
\begin{aligned}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
\nabla \times \mathbf{B} &= \mu_0 \left( \mathbf{J} + \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t} \right)
\end{aligned}
$$
```
به صورت زیر رندر خواهد شد:
$$
\begin{aligned}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
\nabla \times \mathbf{B} &= \mu_0 \left( \mathbf{J} + \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t} \right)
\end{aligned}
$$
## پیکربندی
> [!IMPORTANT]
> لطفاً [افزونه passthrough](https://gohugo.io/content-management/mathematics/) را در فایل پیکربندی Hugo فعال و پیکربندی کنید تا Hugo بتواند عبارت‌های ریاضی LaTeX را در محتوای مارک‌داون شما تشخیص دهد.
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ["$$", "$$"]]
inline: [['\(', '\)']]
enable: true
```
## توابع پشتیبانی شده
@ -57,4 +85,25 @@ $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
```
به صورت زیر رندر خواهد شد:
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
## موتور ریاضی
### MathJax
به طور پیش‌فرض، [KaTeX][katex] برای رندر کردن عبارت‌های ریاضی LaTeX در طول فرآیند ساخت استفاده می‌شود که روش ترجیحی است.
به عنوان جایگزین، می‌توانید از [MathJax][mathjax] برای رندر کردن عبارت‌های ریاضی استفاده کنید.
برای استفاده از آن، موارد زیر را به فایل پیکربندی `hugo.yaml` اضافه کنید:
```yaml {filename="hugo.yaml"}
params:
math:
engine: mathjax
```
[katex]: https://katex.org/
[mathjax]: https://www.mathjax.org/

View File

@ -1,22 +1,10 @@
---
title: "LaTeX"
weight: 4
math: true
---
\(\KaTeX\) LaTeX 数式レンダリングするために使用されます。ページのフロントマターで `math``true` に設定することで、ページごとに有効にすることができます。
<!--more-->
```yaml {filename="page.md"}
---
title: "LaTeX を使用した私のページ"
math: true
---
```
有効にすると、KaTeX のスクリプト、スタイルシート、フォントが自動的にサイトに含まれます。Markdown コンテンツ内で LaTeX 数式を使用できます。
デフォルトでは、\(\KaTeX\) LaTeX 数式レンダリングに使用されます。
手動での有効化は不要で、Markdown コンテンツで LaTeX 数式をすぐに使い始めることができます。
## 例
@ -40,20 +28,6 @@ $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
$$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
> [!IMPORTANT]
> Hugo 設定ファイルで [パススルー拡張機能](https://gohugo.io/content-management/mathematics/) を有効にして設定してください。これにより、複雑な式のレンダリング問題を回避するために、デリミタ内の生のコンテンツが保持されます。
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ['$$', '$$']]
inline: [['\(', '\)']]
enable: true
```
例えば、aligned 環境を使用する場合:
```latex {filename="page.md"}
@ -78,6 +52,23 @@ $$
\end{aligned}
$$
## 設定
> [!IMPORTANT]
> Hugo が Markdown コンテンツ内の LaTeX 数式を検出できるように、Hugo 設定ファイルで [パススルー拡張機能](https://gohugo.io/content-management/mathematics/) を有効にして設定してください。
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ["$$", "$$"]]
inline: [['\(', '\)']]
enable: true
```
## サポートされている関数
サポートされている関数の一覧については、[KaTeX サポートされている関数](https://katex.org/docs/supported.html) を参照してください。
@ -94,4 +85,25 @@ $$
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
```
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
次のようにレンダリングされます:
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
## 数式エンジン
### MathJax
デフォルトでは、ビルドプロセス中に LaTeX 数式をレンダリングするために [KaTeX][katex] が使用されます(推奨)。
代替として、[MathJax][mathjax] を使用して数式をレンダリングすることもできます。
MathJax を使用するには、`hugo.yaml` 設定ファイルに以下を追加してください:
```yaml {filename="hugo.yaml"}
params:
math:
engine: mathjax
```
[katex]: https://katex.org/
[mathjax]: https://www.mathjax.org/

View File

@ -1,9 +1,10 @@
---
title: "LaTeX"
weight: 4
math: true
---
\(\KaTeX\) is used for rendering LaTeX math expressions. No manual activation is needed, you can start using LaTeX math expressions in your Markdown content right away.
By default, \(\KaTeX\) is used for rendering LaTeX math expressions.
No manual activation is needed, you can start using LaTeX math expressions in your Markdown content right away.
## Example
@ -15,7 +16,7 @@ Both inline and separate paragraph LaTeX math expressions are supported in the M
This \(\sigma(z) = \frac{1}{1 + e^{-z}}\) is inline.
```
This \(\sigma(z) = \frac{1}{1 + e^{-z}}\) is inline.
This \( \sigma(z) = \frac{1}{1 + e^{-z}} \) is inline.
### Separate Paragraph
@ -25,21 +26,7 @@ $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
will be rendered as:
$$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
> [!IMPORTANT]
> Please enable and configure the [passthrough extension](https://gohugo.io/content-management/mathematics/) in the Hugo configuration file. It preserves raw content within the delimiters to avoid rendering issues for complex expressions.
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ['$$', '$$']]
inline: [['\(', '\)']]
enable: true
```
$$F(\omega) = \int\_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
For example, using the aligned environment:
@ -65,6 +52,23 @@ $$
\end{aligned}
$$
## Configuration
> [!IMPORTANT]
> Please enable and configure the [passthrough extension](https://gohugo.io/content-management/mathematics/) in the Hugo configuration file, so that Hugo can detect LaTeX math expressions in your Markdown content.
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ["$$", "$$"]]
inline: [['\(', '\)']]
enable: true
```
## Supported Functions
For a list of supported functions, see [KaTeX supported functions](https://katex.org/docs/supported.html).
@ -81,4 +85,25 @@ Separate paragraph:
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
```
will be rendered as:
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
## Math Engine
### MathJax
By default, [KaTeX][katex] is used for rendering LaTeX math expressions during the build process, which is preferred.
Alternatively, you can use [MathJax][mathjax] to render math expressions.
To use it instead, add the following to the configuration `hugo.yaml` file:
```yaml {filename="hugo.yaml"}
params:
math:
engine: mathjax
```
[katex]: https://katex.org/
[mathjax]: https://www.mathjax.org/

View File

@ -4,19 +4,8 @@ weight: 4
math: true
---
\(\KaTeX\) 用于渲染 LaTeX 数学表达式。可以通过在页面前置设置中将 `math` 设置为 `true` 来启用它。
<!--more-->
```yaml {filename="page.md"}
---
title: "我的页面包含 LaTeX"
math: true
---
```
启用后KaTeX 的脚本、样式表和字体将自动包含在您的站点中。您可以在 Markdown 内容中开始使用 LaTeX 数学表达式。
默认情况下,\(\KaTeX\) 用于渲染 LaTeX 数学表达式。
无需手动激活,您可以直接在 Markdown 内容中开始使用 LaTeX 数学表达式。
## 示例
@ -40,20 +29,6 @@ $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
$$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
> [!IMPORTANT]
> 请在 Hugo 配置文件中启用并配置 [passthrough 扩展](https://gohugo.io/content-management/mathematics/)。它保留分隔符内的原始内容,以避免复杂表达式的渲染问题。
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ['$$', '$$']]
inline: [['\(', '\)']]
enable: true
```
例如,使用对齐环境:
```latex {filename="page.md"}
@ -78,6 +53,23 @@ $$
\end{aligned}
$$
## 配置
> [!IMPORTANT]
> 请在 Hugo 配置文件中启用并配置 [passthrough 扩展](https://gohugo.io/content-management/mathematics/),以便 Hugo 可以检测 Markdown 内容中的 LaTeX 数学表达式。
```yaml {filename="hugo.yaml"}
markup:
goldmark:
extensions:
passthrough:
delimiters:
block: [['\[', '\]'], ["$$", "$$"]]
inline: [['\(', '\)']]
enable: true
```
## 支持的函数
有关支持的函数列表,请参阅 [KaTeX 支持的函数](https://katex.org/docs/supported.html)。
@ -94,4 +86,25 @@ $$
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
```
将渲染为:
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
## 数学引擎
### MathJax
默认情况下,使用 [KaTeX][katex] 在构建过程中渲染 LaTeX 数学表达式,这是首选方式。
或者,您可以使用 [MathJax][mathjax] 来渲染数学表达式。
要使用 MathJax请将以下内容添加到 `hugo.yaml` 配置文件中:
```yaml {filename="hugo.yaml"}
params:
math:
engine: mathjax
```
[katex]: https://katex.org/
[mathjax]: https://www.mathjax.org/

View File

@ -41,7 +41,7 @@ Hugoは、テキストのフォーマットやリストの作成などに[Markdo
アラートは、ブロッククォート構文に基づくMarkdown拡張で、重要な情報を強調するために使用できます。
[GitHubスタイルのアラート](https://docs.github.com/ja/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts)がサポートされています。
Hextraの最新バージョンと[Hugo v0.134.0](https://github.com/gohugoio/hugo/releases/tag/v0.134.0)以降を使用していることを確認してください。
Hextraの最新バージョンと[Hugo v0.146.0](https://github.com/gohugoio/hugo/releases/tag/v0.146.0)以降を使用していることを確認してください。
> [!NOTE]
> ユーザーが知っておくべき有用な情報で、内容をざっと見る際にも役立ちます。

View File

@ -41,7 +41,7 @@ Blockquote with attribution
Alerts are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information.
[GitHub-style alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) are supported.
Please make sure you are using the latest version of Hextra and [Hugo v0.134.0](https://github.com/gohugoio/hugo/releases/tag/v0.134.0) or later.
Please make sure you are using the latest version of Hextra and [Hugo v0.146.0](https://github.com/gohugoio/hugo/releases/tag/v0.146.0) or later.
> [!NOTE]
> Useful information that users should know, even when skimming content.

View File

@ -41,7 +41,7 @@ Hugo 支持使用 [Markdown](https://en.wikipedia.org/wiki/Markdown) 语法来
提示框是基于引用块语法的 Markdown 扩展,可用于强调关键信息。
支持 [GitHub 风格的提示框](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts)。
请确保您使用的是最新版本的 Hextra 和 [Hugo v0.134.0](https://github.com/gohugoio/hugo/releases/tag/v0.134.0) 或更高版本。
请确保您使用的是最新版本的 Hextra 和 [Hugo v0.146.0](https://github.com/gohugoio/hugo/releases/tag/v0.146.0) 或更高版本。
> [!NOTE]
> 用户应该知道的有用信息,即使是在浏览内容时。

View File

@ -43,7 +43,7 @@ languages:
module:
hugoVersion:
extended: true
min: "0.134.0"
min: "0.146.0"
workspace: hugo.work
imports:
@ -70,9 +70,8 @@ menu:
name: Documentation
pageRef: /docs
weight: 1
- identifier: showcase
name: Showcase
pageRef: /showcase
- identifier: versions
name: Versions
weight: 2
- identifier: blog
name: Blog
@ -82,15 +81,27 @@ menu:
name: About
pageRef: /about
weight: 4
- name: Search
- identifier: showcase
name: Showcase
pageRef: /showcase
weight: 5
- name: Search
weight: 6
params:
type: search
- name: GitHub
weight: 6
weight: 7
url: "https://github.com/imfing/hextra"
params:
icon: github
- identifier: development
name: Development ↗
url: https://imfing.github.io/hextra/versions/latest/
parent: versions
- identifier: v0.9
name: v0.9 ↗
url: https://imfing.github.io/hextra/versions/v0.9/
parent: versions
sidebar:
- identifier: more
@ -163,10 +174,13 @@ params:
# date | lastmod | publishDate | title | weight
sortBy: date
sortOrder: desc # or "asc"
article:
displayPagination: true
toc:
displayTags: true
highlight:
copy:
enable: true

View File

@ -2,6 +2,7 @@
"htmlElements": {
"tags": [
"a",
"annotation",
"article",
"aside",
"blockquote",
@ -34,13 +35,31 @@
"li",
"link",
"main",
"math",
"meta",
"mfrac",
"mi",
"mn",
"mo",
"mover",
"mpadded",
"mphantom",
"mrow",
"mstyle",
"msub",
"msubsup",
"msup",
"mtable",
"mtd",
"mtext",
"mtr",
"nav",
"ol",
"p",
"path",
"pre",
"script",
"semantics",
"span",
"strong",
"style",
@ -64,14 +83,21 @@
"[counter-reset:step]",
"[hyphens:auto]",
"[word-break:break-word]",
"base",
"chroma",
"col-align-l",
"col-align-r",
"content",
"copy-icon",
"dataframe",
"delimcenter",
"delimsizing",
"filename",
"fix",
"footnote-backref",
"footnote-ref",
"footnotes",
"frac-line",
"hamburger-menu",
"hextra-badge",
"hextra-card",
@ -92,12 +118,19 @@
"hextra-jupyter-code-cell",
"hextra-jupyter-code-cell-outputs",
"hextra-jupyter-code-cell-outputs-container",
"hextra-max-footer-width",
"hextra-max-navbar-width",
"hextra-max-page-width",
"hextra-nav-menu-item",
"hextra-nav-menu-items",
"hextra-nav-menu-toggle",
"hextra-pdf",
"hextra-scrollbar",
"hextra-sidebar-collapsible-button",
"hextra-tabs-panel",
"hextra-tabs-toggle",
"hextra-toc",
"hide-tail",
"highlight",
"hx:-mb-0.5",
"hx:-ml-2",
@ -281,6 +314,7 @@
"hx:duration-200",
"hx:duration-75",
"hx:ease-in",
"hx:ease-in-out",
"hx:first:mt-0",
"hx:flex",
"hx:flex-col",
@ -391,6 +425,7 @@
"hx:ltr:rotate-180",
"hx:ltr:text-right",
"hx:m-[11px]",
"hx:max-h-(--menu-height)",
"hx:max-h-64",
"hx:max-h-[calc(100vh-var(--navbar-height)-env(safe-area-inset-bottom))]",
"hx:max-h-[min(calc(50vh-11rem-env(safe-area-inset-bottom)),400px)]",
@ -404,7 +439,6 @@
"hx:max-w-[90rem]",
"hx:max-w-[min(calc(100vw-2rem),calc(100%+20rem))]",
"hx:max-w-none",
"hx:max-w-screen-xl",
"hx:max-xl:hidden",
"hx:mb-10",
"hx:mb-12",
@ -618,25 +652,66 @@
"hx:z-20",
"hx:z-[-1]",
"icon",
"inner",
"katex",
"katex-display",
"katex-html",
"katex-mathml",
"language-options",
"language-switcher",
"large-op",
"lntable",
"lntd",
"mathbf",
"mathnormal",
"mathrm",
"mbin",
"mclose",
"mermaid",
"mfrac",
"minner",
"mop",
"mopen",
"mord",
"mrel",
"mspace",
"msupsub",
"mtable",
"mtight",
"nav-container",
"nav-container-blur",
"next-error-h1",
"not-prose",
"nulldelimiter",
"op-symbol",
"open",
"pstrut",
"reset-size3",
"reset-size6",
"rlap",
"search-input",
"search-results",
"search-wrapper",
"sidebar-active-item",
"sidebar-container",
"size1",
"size3",
"sizing",
"steps",
"strut",
"subheading-anchor",
"success-icon",
"theme-toggle"
"svg-align",
"text",
"textrm",
"theme-toggle",
"vlist",
"vlist-r",
"vlist-s",
"vlist-t",
"vlist-t2",
"x-arrow",
"x-arrow-pad"
],
"ids": null
}

View File

@ -4,3 +4,5 @@ blog: "وبلاگ"
about: "درباره ما"
more: "بیشتر"
hugoDocs: "مستندات هیوگو ↖"
versions: "نسخه‌ها"
development: "آخرین نسخه توسعه‌ای"

View File

@ -3,4 +3,6 @@ showcase: "展示"
blog: "ブログ"
about: "概要"
more: "もっと見る"
hugoDocs: "Hugo ドキュメント ↗"
hugoDocs: "Hugo ドキュメント ↗"
versions: "バージョン"
development: "最新の開発版"

View File

@ -4,3 +4,5 @@ blog: "博客"
about: "关于"
more: "更多"
hugoDocs: "Hugo 文档 ↗"
versions: "版本"
development: "最新开发版本"

View File

@ -0,0 +1,6 @@
<script defer src="https://cdn.jsdelivr.net/npm/quicklink@3.0.1/dist/quicklink.umd.js"></script>
<script>
window.addEventListener('load', () => {
quicklink.listen();
});
</script>

View File

@ -1,6 +0,0 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/quicklink/2.3.0/quicklink.umd.js"></script>
<script>
window.addEventListener("load", () => {
quicklink.listen();
});
</script>

View File

@ -9,6 +9,7 @@ lastUpdated: "Naposledy změněno"
light: "Světlý"
noResultsFound: "Nebylo nic nalezeno."
onThisPage: "Na této stránce"
tags: "Tagy"
poweredBy: "Powered by Hextra"
readMore: "Přečíst víc →"
searchPlaceholder: "Hledat..."

View File

@ -9,6 +9,7 @@ lastUpdated: "Zuletzt aktualisiert am"
light: "Hell"
noResultsFound: "Keine Ergebnisse gefunden."
onThisPage: "Auf dieser Seite"
tags: "Schlagwörter"
poweredBy: "Unterstützt durch Hextra"
readMore: "Mehr lesen →"
searchPlaceholder: "Suchen..."

View File

@ -9,6 +9,7 @@ lastUpdated: "Last updated on"
light: "Light"
noResultsFound: "No results found."
onThisPage: "On this page"
tags: "Tags"
poweredBy: "Powered by Hextra"
readMore: "Read more →"
searchPlaceholder: "Search..."

View File

@ -8,6 +8,7 @@ lastUpdated: "Última actualización"
light: "Claro"
noResultsFound: "No hubo resultados."
onThisPage: "En esta página"
tags: "Etiquetas"
poweredBy: "Con tecnología de Hextra"
readMore: "Leer más →"
searchPlaceholder: "Buscar..."

View File

@ -9,6 +9,7 @@ lastUpdated: "آخرین به‌روزرسانی در"
light: "روشن"
noResultsFound: "هیچ نتیجه‌ای پیدا نشد."
onThisPage: "در این صفحه"
tags: "برچسب‌ها"
poweredBy: "طراحی شده توسط هگزترا"
readMore: "ادامه مطلب ←"
searchPlaceholder: "جستجو..."

View File

@ -8,6 +8,7 @@ lastUpdated: "Dernière modification"
light: "Clair"
noResultsFound: "Pas de résultats trouvés"
onThisPage: "Sur cette page"
tags: "Étiquettes"
poweredBy: "Propulsé par Hextra"
readMore: "Lire plus →"
searchPlaceholder: "Rechercher..."

View File

@ -9,6 +9,7 @@ lastUpdated: "עודכן לאחרונה ב"
light: "בהיר"
noResultsFound: "לא נמצאו תוצאות."
onThisPage: "בעמוד זה"
tags: "תגיות"
poweredBy: "Hextra מופעל על-ידי"
readMore: "← קרא עוד"
searchPlaceholder: "חיפוש..."

View File

@ -8,6 +8,7 @@ lastUpdated: "最終更新日"
light: "ライト"
noResultsFound: "結果が見つかりませんでした。"
onThisPage: "このページの内容"
tags: "タグ"
poweredBy: "提供元 Hextra"
readMore: "もっと読む →"
searchPlaceholder: "検索..."

View File

@ -8,6 +8,7 @@ lastUpdated: "마지막 수정일자"
light: "밝은 테마"
noResultsFound: "결과 없음"
onThisPage: "페이지 목차"
tags: "태그"
poweredBy: "제공 Hextra"
readMore: "더보기 →"
searchPlaceholder: "검색..."

View File

@ -8,6 +8,7 @@ lastUpdated: "Sist oppdatert"
light: "Lys"
noResultsFound: "Fant ingen treff."
onThisPage: "På denne siden"
tags: "Stikkord"
poweredBy: "Powered by Hextra"
readMore: "Les mer →"
searchPlaceholder: "Søk..."

View File

@ -9,6 +9,7 @@ lastUpdated: "Laatst bijgewerkt op"
light: "Licht"
noResultsFound: "Geen resultaten gevonden."
onThisPage: "Op deze pagina"
tags: "Labels"
poweredBy: "Mogelijk gemaakt door Hextra"
readMore: "Lees meer →"
searchPlaceholder: "Zoeken..."

View File

@ -8,6 +8,7 @@ lastUpdated: "Sist oppdatert"
light: "Ljos"
noResultsFound: "Fann ingen treff."
onThisPage: "På denne sida"
tags: "Stikkord"
poweredBy: "Powered by Hextra"
readMore: "Les meir →"
searchPlaceholder: "Søk..."

View File

@ -8,6 +8,7 @@ lastUpdated: "Última modificação"
light: "Claro"
noResultsFound: "Nenhum resultado encontrado"
onThisPage: "Nesta página"
tags: "Etiquetas"
poweredBy: "Com a tecnologia de Hextra"
readMore: "Ler mais →"
searchPlaceholder: "Procurar..."

View File

@ -9,6 +9,7 @@ lastUpdated: "Ultima actualizare la"
light: "Lumină"
noResultsFound: "Nici un rezultat găsit."
onThisPage: "Pe această pagină"
tags: "Etichete"
poweredBy: "Susținut de Hextra"
readMore: "Citește mai mult ←"
searchPlaceholder: "Caută..."
searchPlaceholder: "Caută..."

View File

@ -9,6 +9,7 @@ lastUpdated: 'Последнее обновление'
light: 'Светлая'
noResultsFound: 'Ничего не найдено.'
onThisPage: 'На этой странице'
tags: 'Теги'
poweredBy: 'При поддержке Hextra'
readMore: 'Читать далее →'
searchPlaceholder: 'Поиск...'

View File

@ -8,6 +8,7 @@ lastUpdated: "Ilisasishwa mwisho"
light: "Meupe"
noResultsFound: "Hakuna matokeo yalipopatikana."
onThisPage: "Kwenye ukurasa huu"
tags: "Lebo"
poweredBy: "Inaendeshwa na Hextra"
readMore: "Soma zaidi →"
searchPlaceholder: "Tafuta..."

View File

@ -9,6 +9,7 @@ lastUpdated: "Востаннє оновлено"
light: "Світла"
noResultsFound: "Не знайдено результатів"
onThisPage: "На цій сторінці"
tags: "Теги"
poweredBy: "Працює завдяки Hextra"
readMore: "Читати більше →"
searchPlaceholder: "Пошук..."

View File

@ -8,6 +8,7 @@ lastUpdated: "Lần cuối cập nhật lúc"
light: "Sáng"
noResultsFound: "Không tìm thấy kết quả."
onThisPage: "Ở trang này"
tags: "Thẻ"
poweredBy: "Chạy bởi Hextra"
readMore: "Đọc thêm →"
searchPlaceholder: "Tìm kiếm..."

View File

@ -8,6 +8,7 @@ lastUpdated: "最后更新于"
light: "浅色"
noResultsFound: "无结果"
onThisPage: "此页上"
tags: "标签"
poweredBy: "由 Hextra 驱动"
readMore: "更多 →"
searchPlaceholder: "搜索文档..."

View File

@ -8,6 +8,7 @@ lastUpdated: "最後更新於"
light: "淺色"
noResultsFound: "無結果"
onThisPage: "此頁上"
tags: "標籤"
poweredBy: "由 Hextra 驅動"
readMore: "更多 →"
searchPlaceholder: "搜尋文檔..."

View File

@ -1,9 +0,0 @@
{{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq .Type "block") }}
{{- with try (transform.ToMath .Inner $opts) }}
{{- with .Err }}
{{ errorf "Unable to render mathematical markup to HTML using the transform.ToMath function. The KaTeX display engine threw the following error: %s: see %s." . $.Position }}
{{- else }}
{{- .Value }}
{{- $.Page.Store.Set "hasMath" true }}
{{- end }}
{{- end -}}

View File

@ -0,0 +1,20 @@
{{- $engine := site.Params.math.engine | default "katex" -}}
{{- if eq $engine "katex" -}}
{{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq .Type "block") }}
{{- with try (transform.ToMath .Inner $opts) }}
{{- with .Err }}
{{ errorf "Unable to render mathematical markup to HTML using the transform.ToMath function. The KaTeX display engine threw the following error: %s: see %s." . $.Position }}
{{- else }}
{{- .Value }}
{{- $.Page.Store.Set "hasMath" true }}
{{- end }}
{{- end }}
{{- else -}}
{{/* MathJax - need to add delimiters back in */}}
{{- $.Page.Store.Set "hasMath" true }}
{{- if eq .Type "block" -}}
\[{{- .Inner -}}\]
{{- else -}}
\( {{- .Inner -}} \)
{{- end -}}
{{- end -}}

View File

@ -12,7 +12,7 @@
{{- if .IsHome -}}
{{ .Site.Title -}}
{{ else -}}
{{ with .Title }}{{ . }} {{ end -}}
{{ with .Title }}{{ . }} {{ end -}}
{{ .Site.Title -}}
{{ end -}}
</title>
@ -25,27 +25,32 @@
{{- end -}}
{{- partial "opengraph.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{- partial "schema.html" . -}}
{{- partial "twitter_cards.html" . -}}
{{- $mainCss := resources.Get "css/compiled/main.css" -}}
{{- $customCss := resources.Get "css/custom.css" -}}
{{- $variablesCss := resources.Get "css/variables.css" | resources.ExecuteAsTemplate "css/variables.css" . -}}
{{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }}
{{- /* Production build */ -}}
{{- if hugo.IsProduction }}
{{- $styles := slice $variablesCss $mainCss $customCss | resources.Concat "css/compiled/main.css" | minify | fingerprint }}
<link rel="preload" href="{{ $styles.RelPermalink }}" as="style" integrity="{{ $styles.Data.Integrity }}" />
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" integrity="{{ $styles.Data.Integrity }}" />
{{- /* Theme development mode (non-production + theme environment) */ -}}
{{- else if eq hugo.Environment "theme" }}
{{- $devStyles := resources.Get "css/styles.css" | postCSS (dict "inlineImports" true) }}
<link href="{{ $devStyles.RelPermalink }}" rel="stylesheet" />
<link href="{{ $variablesCss.RelPermalink }}" rel="stylesheet" />
<link href="{{ $customCss.RelPermalink }}" rel="stylesheet" />
{{- /* User local development */ -}}
{{- else }}
{{- if hugo.IsProduction }}
{{- $styles := slice $variablesCss $mainCss $customCss | resources.Concat "css/compiled/main.css" | minify | fingerprint }}
<link rel="preload" href="{{ $styles.RelPermalink }}" as="style" integrity="{{ $styles.Data.Integrity }}" />
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" integrity="{{ $styles.Data.Integrity }}" />
{{- else }}
{{- $styles := resources.Get "css/compiled/main.css" -}}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
<link href="{{ $variablesCss.RelPermalink }}" rel="stylesheet" />
<link href="{{ $customCss.RelPermalink }}" rel="stylesheet" />
{{- end }}
{{- $styles := resources.Get "css/compiled/main.css" -}}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
<link href="{{ $variablesCss.RelPermalink }}" rel="stylesheet" />
<link href="{{ $customCss.RelPermalink }}" rel="stylesheet" />
{{- end }}
@ -80,7 +85,8 @@
<!-- KaTeX-->
{{ $noop := .WordCount -}}
{{ if .Page.Store.Get "hasMath" -}}
{{- $engine := site.Params.math.engine | default "katex" -}}
{{ if and (.Page.Store.Get "hasMath") (eq $engine "katex") -}}
<!-- TODO: make url configurable -->
{{ $katexBaseUrl := "https://cdn.jsdelivr.net/npm/katex@latest/dist" }}
{{ $katexCssUrl := printf "%s/katex%s.css" $katexBaseUrl (cond hugo.IsProduction ".min" "") -}}
@ -90,13 +96,16 @@
{{ with try (resources.GetRemote $katexCssUrl) -}}
{{ with .Err -}}
{{ errorf "Could not retrieve KaTeX css file from %s. Reason: %s." $katexCssUrl . -}}
{{ else with.Value -}}
{{ else with .Value -}}
{{ $katexCssContent := strings.Replace .Content $katexFontPattern $katexFontSubstituted }}
{{ with resources.FromString (printf "css/katex%s.css" (cond hugo.IsProduction ".min" "")) $katexCssContent -}}
<link rel="stylesheet" href="{{- .RelPermalink -}}" integrity="{{- . | fingerprint -}}" crossorigin="anonymous" />
{{ $cssHash := . | fingerprint "sha512" -}}
<link rel="stylesheet" href="{{- .RelPermalink -}}" integrity="{{- $cssHash.Data.Integrity -}}" crossorigin="anonymous" />
{{ end -}}
{{ end -}}
{{ end -}}
{{ else if and (.Page.Store.Get "hasMath") (eq $engine "mathjax") -}}
{{ partialCached "scripts/mathjax.html" . -}}
{{ end -}}
{{ partial "custom/head-end.html" . -}}

View File

@ -13,8 +13,11 @@
{{ end -}}
{{- end -}}
<div class="nav-container hx:sticky hx:top-0 hx:z-20 hx:w-full hx:bg-transparent hx:print:hidden">
<div class="nav-container-blur hx:pointer-events-none hx:absolute hx:z-[-1] hx:h-full hx:w-full hx:bg-white hx:dark:bg-dark hx:shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] hx:contrast-more:shadow-[0_0_0_1px_#000] hx:dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] hx:contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
<div
class="nav-container-blur hx:pointer-events-none hx:absolute hx:z-[-1] hx:h-full hx:w-full hx:bg-white hx:dark:bg-dark hx:shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] hx:contrast-more:shadow-[0_0_0_1px_#000] hx:dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] hx:contrast-more:dark:shadow-[0_0_0_1px_#fff]"
></div>
<nav class="hextra-max-navbar-width hx:mx-auto hx:flex hx:items-center hx:justify-end hx:gap-2 hx:h-16 hx:px-6">
<a class="hx:flex hx:items-center hx:hover:opacity-75 hx:ltr:mr-auto hx:rtl:ml-auto" href="{{ $logoLink }}">
@ -51,14 +54,55 @@
{{- else -}}
{{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}}
{{- $activeClass := cond $active "hx:font-medium" "hx:text-gray-600 hx:hover:text-gray-800 hx:dark:text-gray-400 hx:dark:hover:text-gray-200" -}}
<a
title="{{ or (T .Identifier) .Name | safeHTML }}"
href="{{ $link }}"
{{ if $external }}target="_blank" rel="noreferrer"{{ end }}
class="hx:text-sm hx:contrast-more:text-gray-700 hx:contrast-more:dark:text-gray-100 hx:relative hx:-ml-2 hx:hidden hx:whitespace-nowrap hx:p-2 hx:md:inline-block {{ $activeClass }}"
>
<span class="hx:text-center">{{ or (T .Identifier) .Name | safeHTML }}</span>
</a>
{{- if .HasChildren -}}
{{/* Dropdown menu for items with children */}}
<div class="hx:relative hx:hidden hx:md:inline-block">
<button
title="{{ or (T .Identifier) .Name | safeHTML }}"
data-state="closed"
class="hextra-nav-menu-toggle hx:cursor-pointer hx:text-sm hx:contrast-more:text-gray-700 hx:contrast-more:dark:text-gray-100 hx:relative hx:-ml-2 hx:whitespace-nowrap hx:p-2 hx:flex hx:items-center hx:gap-1 {{ $activeClass }}"
type="button"
aria-label="{{ or (T .Identifier) .Name | safeHTML }}"
>
<span class="hx:text-center">{{ or (T .Identifier) .Name | safeHTML }}</span>
{{- partial "utils/icon.html" (dict "name" "chevron-down" "attributes" "height=12 class=\"hx:transition-transform hx:duration-200 hx:ease-in-out\"") -}}
</button>
<ul
class="hextra-nav-menu-items hx:hidden hx:z-20 hx:max-h-64 hx:overflow-auto hx:rounded-md hx:ring-1 hx:ring-black/5 hx:bg-white hx:py-1 hx:text-sm hx:shadow-lg hx:dark:ring-white/20 hx:dark:bg-neutral-800"
style="min-width: 100px;"
>
{{ range .Children }}
{{- $link := .URL -}}
{{- $external := strings.HasPrefix $link "http" -}}
{{- with .PageRef -}}
{{- if hasPrefix . "/" -}}
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
{{- end -}}
{{- end -}}
<li class="hextra-nav-menu-item hx:flex hx:flex-col">
<a
href="{{ $link }}"
{{ if $external }}target="_blank" rel="noreferrer"{{ end }}
class="hx:text-gray-600 hx:hover:text-gray-800 hx:dark:text-gray-400 hx:dark:hover:text-gray-200 hx:relative hx:cursor-pointer hx:whitespace-nowrap hx:py-1.5 hx:transition-colors hx:ltr:pl-3 hx:ltr:pr-9 hx:rtl:pr-3 hx:rtl:pl-9"
>
{{- or (T .Identifier) .Name | safeHTML -}}
</a>
</li>
{{- end -}}
</ul>
</div>
{{- else -}}
{{/* Regular menu item without children */}}
<a
title="{{ or (T .Identifier) .Name | safeHTML }}"
href="{{ $link }}"
{{ if $external }}target="_blank" rel="noreferrer"{{ end }}
class="hx:text-sm hx:contrast-more:text-gray-700 hx:contrast-more:dark:text-gray-100 hx:relative hx:-ml-2 hx:hidden hx:whitespace-nowrap hx:p-2 hx:md:inline-block {{ $activeClass }}"
>
<span class="hx:text-center">{{ or (T .Identifier) .Name | safeHTML }}</span>
</a>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@ -2,12 +2,13 @@
{{- $jsMenu := resources.Get "js/menu.js" -}}
{{- $jsTabs := resources.Get "js/tabs.js" -}}
{{- $jsLang := resources.Get "js/lang.js" -}}
{{- $jsNavMenu := resources.Get "js/nav-menu.js" -}}
{{- $jsCodeCopy := resources.Get "js/code-copy.js" -}}
{{- $jsFileTree := resources.Get "js/filetree.js" -}}
{{- $jsSidebar := resources.Get "js/sidebar.js" -}}
{{- $jsBackToTop := resources.Get "js/back-to-top.js" -}}
{{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}}
{{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsNavMenu $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}}
{{- if hugo.IsProduction -}}
{{- $scripts = $scripts | minify | fingerprint -}}
{{- end -}}

View File

@ -0,0 +1,21 @@
{{/* MathJax */}}
{{ $mathjaxVersion := site.Params.math.mathjaxVersion | default "3" -}}
{{ $mathjaxJsUrl := printf "https://cdn.jsdelivr.net/npm/mathjax@%s/es5/tex-chtml.js" $mathjaxVersion -}}
<script defer id="MathJax-script" src="{{ $mathjaxJsUrl }}" crossorigin="anonymous" async></script>
<script>
MathJax = {
loader: {
load: ["ui/safe"],
},
tex: {
displayMath: [
["\\[", "\\]"],
["$$", "$$"],
],
inlineMath: [
["\\(", "\\)"],
["$", "$"],
],
},
};
</script>

View File

@ -0,0 +1,7 @@
<p class="hx:opacity-50 hx:text-sm hx:leading-7">
{{- range $tag := .Params.tags -}}
{{- with $.Site.GetPage (printf "/tags/%s" $tag) -}}
<a class="hx:inline-block hx:mr-2" href="{{ .RelPermalink }}">#{{ .Title }}</a>
{{- end -}}
{{- end -}}
</p>

View File

@ -2,6 +2,7 @@
{{/* TODO: toc bottom part should be able to hide */}}
{{- $toc := .Params.toc | default true -}}
{{- $onThisPage := (T "onThisPage") | default "On this page"}}
{{- $tags := (T "tags") | default "Tags"}}
{{- $editThisPage := (T "editThisPage") | default "Edit this page"}}
{{- $backToTop := (T "backToTop") | default "Scroll to top" -}}
@ -18,6 +19,14 @@
{{- end -}}
{{- $borderClass := "hx:mt-8 hx:border-t hx:bg-white hx:pt-8 hx:shadow-[0_-12px_16px_white] hx:dark:bg-dark hx:dark:shadow-[0_-12px_16px_#111]" -}}
{{- if and site.Params.toc.displayTags .Params.tags -}}
<div class="{{ $borderClass }} hx:sticky hx:bottom-0 hx:flex hx:flex-col hx:items-start hx:gap-2 hx:border-gray-200 hx:dark:border-neutral-800 hx:contrast-more:border-t hx:contrast-more:border-neutral-400 hx:contrast-more:shadow-none hx:contrast-more:dark:border-neutral-400">
<p class="hx:mb-1 hx:font-semibold hx:tracking-tight">{{ $tags }}</p>
{{ partial "tags.html" . }}
</div>
{{- end -}}
{{- if not .Fragments.Headings -}}
{{- $borderClass = "" -}}
{{- end -}}

Some files were not shown because too many files have changed in this diff Show More