forked from drowl87/hextra_mirror
chore(i18n): improve translations of zh-cn (#14)
This commit is contained in:
parent
e1a2109a68
commit
b709452d16
@ -3,15 +3,15 @@ title: 关于
|
||||
toc: false
|
||||
---
|
||||
|
||||
Hextra 是一款简洁, 快速, 灵活的主题, 适用于构建现代化静态站点. Hextra 特别适用于文档网站, 但也可用于构建,博客, 投资组合网站等各种类型的网站.
|
||||
Hextra 是一款简洁、快速、灵活的主题,适用于构建现代化静态站点。Hextra 特别适用于文档网站,但也可用于构建博客、个人网站等各种类型的网站。
|
||||
|
||||
Hugo 和 Jekyll 类似, 是一个静态网站生成器, 但与其他生成器不同, Hugo 只有单个可执行文件, 这使得它可以轻松地在各种平台上安装和运行. Hugo 的运行速度非常快且可靠性高, 能够在几毫秒内渲染数千页的网站.
|
||||
Hugo 和 Jekyll 类似,是一个静态网站生成器。但与其他生成器不同,Hugo 只有单个可执行文件,这使得它可以轻松地在各种平台上安装和运行。Hugo 的运行速度非常快且可靠性高,能够在几毫秒内渲染数千页的网站。
|
||||
|
||||
Hextra 被设计为轻量级, 具有最小化的内存占用. 使用 Hextra 无需安装繁杂的依赖, 比如 Node.js; 相反, 你只需要一个简单的 YAML 配置文件和 Markdown 内容. 因此, 我们可以专注于内容而非在配置环境上浪费精力
|
||||
Hextra 被设计为轻量级,具有最小化的内存占用。使用 Hextra 无需安装繁杂的依赖,比如 Node.js;相反,你只需要一个简单的 YAML 配置文件和 Markdown 内容。因此,我们可以专注于内容而非在配置环境上浪费精力。
|
||||
|
||||
## 鸣谢
|
||||
|
||||
Hextra 的设计离不开这些项目的支持和其提供的灵感:
|
||||
Hextra 的设计离不开这些项目的支持和其提供的灵感:
|
||||
|
||||
- [Hugo](https://gohugo.io/)
|
||||
- [Tailwind CSS](https://tailwindcss.com/)
|
||||
|
137
exampleSite/content/blog/markdown.zh-cn.md
Normal file
137
exampleSite/content/blog/markdown.zh-cn.md
Normal file
@ -0,0 +1,137 @@
|
||||
---
|
||||
title: Markdown 语法指南
|
||||
date: 2020-01-01
|
||||
authors:
|
||||
- name: John Doe
|
||||
link: https://example.com/johndoe
|
||||
excludeSearch: true
|
||||
---
|
||||
|
||||
这篇文章提供了一些基础的 Markdown 语法样例,这些可以在 Hugo 的内容文件中使用。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 基础语法
|
||||
|
||||
### 标题
|
||||
|
||||
```
|
||||
# 一级标题
|
||||
## 二级标题
|
||||
### 三级标题
|
||||
#### 四级标题
|
||||
##### 五级标题
|
||||
###### 六级标题
|
||||
```
|
||||
|
||||
## 二级标题
|
||||
### 三级标题
|
||||
#### 四级标题
|
||||
##### 五级标题
|
||||
###### 六级标题
|
||||
|
||||
```text
|
||||
*这段文字将是斜体*
|
||||
_这也将是斜体_
|
||||
|
||||
**这段文字将是粗体**
|
||||
__这也将是粗体__
|
||||
|
||||
_你 **可以** 组合它们_
|
||||
```
|
||||
|
||||
*这段文字将是斜体*
|
||||
_这也将是斜体_
|
||||
|
||||
**这段文字将是粗体**
|
||||
__这也将是粗体__
|
||||
|
||||
_你 **可以** 组合它们_
|
||||
|
||||
### 列表
|
||||
|
||||
#### 无序列表
|
||||
|
||||
* 项目 1
|
||||
* 项目 2
|
||||
* 项目 2a
|
||||
* 项目 2b
|
||||
|
||||
#### 有序列表
|
||||
|
||||
1. 项目 1
|
||||
2. 项目 2
|
||||
3. 项目 3
|
||||
1. 项目 3a
|
||||
2. 项目 3b
|
||||
|
||||
### 图片
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||

|
||||
|
||||
### 链接
|
||||
|
||||
```markdown
|
||||
[Hugo](https://gohugo.io)
|
||||
```
|
||||
|
||||
[Hugo](https://gohugo.io)
|
||||
|
||||
### 块引用
|
||||
|
||||
```markdown
|
||||
牛顿曾说:
|
||||
|
||||
> 如果我看得更远,那是因为我站在巨人的肩膀上。
|
||||
```
|
||||
|
||||
> 如果我看得更远,那是因为我站在巨人的肩膀上。
|
||||
|
||||
### 行内代码
|
||||
|
||||
```markdown
|
||||
行内 `代码` 有 `反引号` 包围。
|
||||
```
|
||||
|
||||
行内 `代码` 有 `反引号` 包围。
|
||||
|
||||
### 代码块
|
||||
|
||||
#### 语法高亮
|
||||
|
||||
````markdown
|
||||
```go
|
||||
func main() {
|
||||
fmt.Println("Hello World")
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
```go
|
||||
func main() {
|
||||
fmt.Println("Hello World")
|
||||
}
|
||||
```
|
||||
|
||||
### 表格
|
||||
|
||||
```markdown
|
||||
| Syntax | Description |
|
||||
| --------- | ----------- |
|
||||
| Header | Title |
|
||||
| Paragraph | Text |
|
||||
```
|
||||
|
||||
| Syntax | Description |
|
||||
| --------- | ----------- |
|
||||
| Header | Title |
|
||||
| Paragraph | Text |
|
||||
|
||||
## 参考
|
||||
|
||||
- [Markdown Syntax](https://www.markdownguide.org/basic-syntax/)
|
||||
- [Hugo Markdown](https://gohugo.io/content-management/formats/#markdown)
|
@ -3,27 +3,28 @@ linkTitle: "文档"
|
||||
title: 介绍
|
||||
---
|
||||
|
||||
👋 嘿, 你好! 欢迎来到 Hextra 的文档!
|
||||
👋 你好!欢迎来到 Hextra 文档!
|
||||
|
||||
<!--more-->
|
||||
|
||||
## Hextra 是什么?
|
||||
Hextra 是一个现代化, 快速和开箱即用的 [Hugo][hugo] 主题, 使用 [Tailwind CSS][tailwind-css] 构建.
|
||||
被设计于构建美观的文档, 博客等网站, Hextra 提供了一些开箱即用的功能和强大的可扩展性以面对各种而样的需求.
|
||||
## Hextra 是什么?
|
||||
|
||||
## 功能
|
||||
Hextra 是一款现代、快速且内置丰富功能的 [Hugo][hugo] 主题,它是用 [Tailwind CSS][tailwind-css] 构建的。该主题旨在创建美观的文档、博客和网站,提供了开箱即用的功能和灵活性以满足各种需求。
|
||||
|
||||
- **美观的设计** - 受 Nextra 的启发,Hextra 利用 Tailwind CSS 提供现代化的设计,使您的网站看起来美观有加.
|
||||
- **响应式布局和深色模式支持** - 在任何设备上看起来都足够美观, 无论是手机, 平板电脑或者电脑. 深色模式的支持使 Hextra 可以应对各种照明环境.
|
||||
- **快速且轻量** - 由 Hugo 强力支持, Hugo 是一个快如闪电的静态站点生成器, 这一切都只需一个可执行文件, Hextra 始终保持最小化, 无需 Javascript 或者 Node.js.
|
||||
- **全文搜索** - 集成了 Flexsearch 的全文搜索, 无需额外的配置.
|
||||
- **网站中的瑞士军刀** - Markdown, 代码高亮, LaTex 数学公式, diagrams 图表和 Shortcodes 都可以用于丰富你的内容. 目录, 面包屑导航, 分页, 侧边栏等均由 Hextra 自动生成。
|
||||
- **多语言和 SEO Ready** - Hugo 的多语言模式使得构建多语言网站更简单. 具有 SEO tags, Open Graph, 和 Twitter Cards 等诸多开箱即用的功能.
|
||||
## 功能特点
|
||||
|
||||
## 有问题或反馈?
|
||||
- **优美的设计** - 受到 Nextra 的启发,Hextra 利用 Tailwind CSS 提供了一种现代设计,使您的网站看起来出色。
|
||||
- **响应式布局和深色模式** - 无论是在移动设备、平板还是桌面上,都表现出色。同时支持深色模式以适应各种光线条件。
|
||||
- **快速和轻量级** - 由 Hugo 驱动,一个轻量级且超快的静态网站生成器,封装在一个单一的二进制文件中,Hextra 保持其占用极小。使用它不需要 Javascript 或 Node.js。
|
||||
- **全文搜索** - 内置的离线全文搜索由 FlexSearch 提供支持,无需额外配置。
|
||||
- **功能全面** - 支持 Markdown、语法高亮、LaTeX 数学公式、图表以及 Shortcodes 元素以增强您的内容。目录、面包屑、分页、侧边栏导航等都会自动生成。
|
||||
- **多语言和 SEO 支持** - Hugo 的多语言模式轻松支持多语言网站。对于 SEO 标签、Open Graph 和 Twitter 卡片,也提供了开箱即用的支持。
|
||||
|
||||
## 有问题或反馈?
|
||||
|
||||
{{< callout emoji="❓" >}}
|
||||
Hextra 仍在持续开发中. 有问题或者反馈? 在 GitHub 上 [创建 Issues](https://github.com/imfing/hextra/issues)!
|
||||
Hextra 仍在积极开发中。
|
||||
有问题或反馈?请随时[提出问题](https://github.com/imfing/hextra/issues)!
|
||||
{{< /callout >}}
|
||||
|
||||
## 接下来
|
||||
@ -31,9 +32,9 @@ Hextra 是一个现代化, 快速和开箱即用的 [Hugo][hugo] 主题, 使用
|
||||
直接进入以下部分开始:
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="getting-started" title="快速开始" icon="document-text" subtitle="学习如何使用 Hextra 创建网站" >}}
|
||||
{{< card link="getting-started" title="入门指南" icon="document-text" subtitle="学习如何使用 Hextra 创建网站" >}}
|
||||
{{< /cards >}}
|
||||
|
||||
[hugo]: https://gohugo.io/
|
||||
[flex-search]: https://github.com/nextapps-de/flexsearch
|
||||
[tailwind-css]: https://tailwindcss.com/
|
||||
[tailwind-css]: https://tailwindcss.com/
|
||||
|
@ -5,11 +5,11 @@ prev: /docs/guide/shortcodes/tabs
|
||||
next: /docs/advanced/multi-language
|
||||
---
|
||||
|
||||
此部分提供了 Hextra 的一些高级配置.
|
||||
此部分提供了 Hextra 的一些高级配置。
|
||||
|
||||
<!--more-->
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="multi-language" title="多语言" icon="translate" >}}
|
||||
{{< card link="customization" title="定制化" icon="pencil" >}}
|
||||
{{< /cards >}}
|
||||
{{< /cards >}}
|
||||
|
@ -3,14 +3,14 @@ title: 自定义 Hextra
|
||||
linkTitle: 自定义
|
||||
---
|
||||
|
||||
Hextra 在 `hugo.yaml` 中提供了一些自定义选项来配置主题.
|
||||
本页介绍了可用选项以及如何进一步自定义主题.
|
||||
Hextra 在 `hugo.yaml` 中提供了一些自定义选项来配置主题。
|
||||
本页介绍了可用选项以及如何进一步自定义主题。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 自定义 CSS
|
||||
|
||||
要添加自定义 CSS,我们需要在站点中创建一个文件 `assets/css/custom.css`. Hextra 将自动加载该文件, 比如自定义字体:
|
||||
要添加自定义 CSS,我们需要在站点中创建一个文件 `assets/css/custom.css`。Hextra 将自动加载该文件,比如自定义字体:
|
||||
|
||||
```css {filename="assets/css/custom.css"}
|
||||
.content {
|
||||
@ -30,17 +30,17 @@ Hextra 在 `hugo.yaml` 中提供了一些自定义选项来配置主题.
|
||||
|
||||
### 代码高亮
|
||||
|
||||
代码高亮风格的详细信息可在 [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html) 中找到. 可以使用以下命令生成样式表:
|
||||
代码高亮风格的详细信息可在 [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html) 中找到。 可以使用以下命令生成样式表:
|
||||
|
||||
```bash
|
||||
$ hugo gen chromastyles --style=github
|
||||
```
|
||||
|
||||
可将生成的样式添加到自定义 CSS 文件中以覆盖默认代码高亮样式.
|
||||
可将生成的样式添加到自定义 CSS 文件中以覆盖默认代码高亮样式。
|
||||
|
||||
## 自定义 Script
|
||||
|
||||
你可以添加以下文件以自定义 `script` 添加到每页的 `head` 或 `end`.
|
||||
你可以添加以下文件以自定义 `script` 添加到每页的 `head` 最后:
|
||||
|
||||
```
|
||||
layouts/partials/custom/head-end.html
|
||||
@ -48,11 +48,11 @@ layouts/partials/custom/head-end.html
|
||||
|
||||
## 自定义布局
|
||||
|
||||
可以在站点的 `layouts` 目录中创建同名文件来覆盖主题的默认布局.
|
||||
例如,要覆盖文档的 `single.html` 布局,在站点中创建文件 `layouts/docs/single.html`.
|
||||
可以在站点的 `layouts` 目录中创建同名文件来覆盖主题的默认布局。
|
||||
例如,要覆盖文档的 `single.html` 布局,在站点中创建文件 `layouts/docs/single.html`。
|
||||
|
||||
如需或许更多信息, 转至 [Hugo Templates](https://gohugo.io/templates/).
|
||||
如需或许更多信息,转至 [Hugo Templates](https://gohugo.io/templates/)。
|
||||
|
||||
## 进一步定制 Hextra
|
||||
|
||||
没有找到你想修改的东西?在 GitHub 上[创建 Issues](https://github.com/imfing/hextra/issues) 或为 Hextra 贡献你的智慧!
|
||||
没有找到你想修改的东西?在 GitHub 上[创建 Issues](https://github.com/imfing/hextra/issues) 或为 Hextra 贡献你的智慧!
|
||||
|
@ -4,13 +4,13 @@ weight: 1
|
||||
prev: /docs/advanced
|
||||
---
|
||||
|
||||
Hextra 支持使用 Hugo 的[多语言模式](https://gohugo.io/content-management/multilingual/) 创建多语言的网站.
|
||||
Hextra 支持使用 Hugo 的[多语言模式](https://gohugo.io/content-management/multilingual/) 创建多语言的网站。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 启用多语言支持
|
||||
|
||||
为了使我们的网站支持多语言,我们需要告诉 Hugo 需要支持的语言. 在站点配置文件中添加:
|
||||
为了使我们的网站支持多语言,我们需要告诉 Hugo 需要支持的语言。 在站点配置文件中添加:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
defaultContentLanguage: en
|
||||
@ -28,7 +28,7 @@ languages:
|
||||
|
||||
## 按文件名管理翻译
|
||||
|
||||
Hugo 支持按文件名管理翻译. 例如, 如果我们有一个英文文件 `content/docs/_index.md`, 我们可以创建一个翻译为法语的文件 `content/docs/_index.fr.md`.
|
||||
Hugo 支持按文件名管理翻译。例如,如果我们有一个英文文件 `content/docs/_index.md`,我们可以创建一个翻译为法语的文件 `content/docs/_index.fr.md`。
|
||||
|
||||
{{< filetree/container >}}
|
||||
{{< filetree/folder name="content" >}}
|
||||
@ -40,11 +40,11 @@ Hugo 支持按文件名管理翻译. 例如, 如果我们有一个英文文件 `
|
||||
{{< /filetree/folder >}}
|
||||
{{< /filetree/container >}}
|
||||
|
||||
注意:Hugo 还支持[按内容目录管理翻译](https://gohugo.io/content-management/multilingual/#translation-by-content-directory).
|
||||
注意:Hugo 还支持[按内容目录管理翻译](https://gohugo.io/content-management/multilingual/#translation-by-content-directory)。
|
||||
|
||||
## 翻译菜单项
|
||||
|
||||
要翻译导航栏中的菜单项,我们需要设置 `identifier` 字段:
|
||||
要翻译导航栏中的菜单项,我们需要设置 `identifier` 字段:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
menu:
|
||||
@ -61,7 +61,7 @@ menu:
|
||||
|
||||
## 翻译字符串
|
||||
|
||||
要翻译其他地方的字符串, 我们需要将翻译添加到相应的 i18n 文件中:
|
||||
要翻译其他地方的字符串,我们需要将翻译添加到相应的 `i18n` 文件中:
|
||||
|
||||
```yaml {filename="i18n/fr.yaml"}
|
||||
readMore: Lire la suite
|
||||
|
@ -9,22 +9,22 @@ prev: /docs
|
||||
|
||||
{{< icon "github" >}} [imfing/hextra-starter-template](https://github.com/imfing/hextra-starter-template)
|
||||
|
||||
你可以使用此模板仓库以便于快速开始.
|
||||
通过使用上面的模板仓库,您将能够快速地开始。
|
||||
|
||||
<img src="https://docs.github.com/assets/cb-77734/mw-1440/images/help/repository/use-this-template-button.webp" width="500">
|
||||
|
||||
我们提供了一个 [GitHub Actions workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow) 来帮助你免费在 GitHub Pages 上自动构建和部署网站.
|
||||
我们提供了一个 [GitHub Actions 工作流](https://docs.github.com/cn/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow),它可以帮助您自动构建并部署您的网站到 GitHub Pages,并免费托管。
|
||||
|
||||
[🌐 演示 ↗](https://imfing.github.io/hextra-starter-template/)
|
||||
|
||||
## 全新开始
|
||||
## 作为新项目开始
|
||||
|
||||
### 先决条件
|
||||
### 前提条件
|
||||
|
||||
在我们开始之前, 必须先确保 [Hugo](https://gohugo.io/) 已被正确安装.
|
||||
转至 Hugo 的 [official installation guide](https://gohugo.io/installation/) 以获取更多信息.
|
||||
在开始之前,请确保我们已经安装了 [Hugo](https://gohugo.io/)。
|
||||
请参考 Hugo 的[官方安装指南](https://gohugo.io/installation/)以获取更多详情。
|
||||
|
||||
推荐使用 [Hugo modules](https://gohugo.io/hugo-modules/) 管理 Hugo 主题. 使用 Hugo modules 需要先正确安装 [Git](https://git-scm.com/) 和 [Go](https://go.dev/).
|
||||
[Hugo 模块](https://gohugo.io/hugo-modules/)是管理 Hugo 主题的推荐方式。要使用 Hugo 模块,我们需要安装 [Git](https://git-scm.com/) 和 [Go](https://go.dev/)。
|
||||
|
||||
{{% steps %}}
|
||||
|
||||
@ -34,7 +34,7 @@ prev: /docs
|
||||
$ hugo new site my-site --format=yaml
|
||||
```
|
||||
|
||||
### 通过 module 配置 Hextra
|
||||
### 通过模块配置 Hextra 主题
|
||||
|
||||
```shell
|
||||
# 初始化 Hugo 模块
|
||||
@ -45,7 +45,7 @@ $ hugo mod init github.com/username/my-site
|
||||
$ hugo mod get github.com/imfing/hextra
|
||||
```
|
||||
|
||||
编辑 `hugo.yaml` 以启用 Hextra:
|
||||
编辑 `hugo.yaml` 以启用 Hextra:
|
||||
|
||||
```yaml
|
||||
module:
|
||||
@ -55,7 +55,7 @@ module:
|
||||
|
||||
### 创建你的第一个内容页
|
||||
|
||||
现在, 创建一些新的内容页, 比如 主页 和 文档:
|
||||
让我们为主页和文档页面创建一个新的内容页面:
|
||||
|
||||
```shell
|
||||
$ hugo new content/_index.md
|
||||
@ -68,13 +68,13 @@ $ hugo new content/docs/_index.md
|
||||
$ hugo server --buildDrafts --disableFastRender
|
||||
```
|
||||
|
||||
瞧! 你现在可以在 `http://localhost:1313/` 看到你的新站点.
|
||||
瞧!你现在可以在 `http://localhost:1313/` 看到你的新站点。
|
||||
|
||||
{{% /steps %}}
|
||||
|
||||
## 接下来
|
||||
|
||||
你可以探索以下部分来添加更多内容:
|
||||
你可以探索以下部分来添加更多内容:
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="../guide/organize-files" title="目录结构" icon="document-duplicate" >}}
|
||||
|
@ -7,7 +7,7 @@ sidebar:
|
||||
open: true
|
||||
---
|
||||
|
||||
探索以下部分以学习使用 Hextra 撰写内容:
|
||||
探索以下各节以学习如何使用 Hextra 编写内容:
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -15,8 +15,8 @@ sidebar:
|
||||
{{< card link="organize-files" title="目录结构" icon="document-duplicate" >}}
|
||||
{{< card link="configuration" title="配置" icon="adjustments" >}}
|
||||
{{< card link="markdown" title="Markdown" icon="markdown" >}}
|
||||
{{< card link="syntax-highlighting" title="代码高Liam和" icon="sparkles" >}}
|
||||
{{< card link="latex" title="LaTeX" icon="variable" >}}
|
||||
{{< card link="diagrams" title="Diagrams" icon="chart-square-bar" >}}
|
||||
{{< card link="shortcodes" title="Shortcodes" icon="template" >}}
|
||||
{{< card link="syntax-highlighting" title="代码高亮" icon="sparkles" >}}
|
||||
{{< card link="latex" title="LaTeX 公式" icon="variable" >}}
|
||||
{{< card link="diagrams" title="图表" icon="chart-square-bar" >}}
|
||||
{{< card link="shortcodes" title="短代码" icon="template" >}}
|
||||
{{< /cards >}}
|
||||
|
@ -3,16 +3,17 @@ title: 配置文件
|
||||
weight: 2
|
||||
---
|
||||
|
||||
Hugo 从 Hugo 网站根目录下的 `hugo.yaml` 读取配置.
|
||||
在配置文件中, 您可以配置站点的所有选项.
|
||||
你可以在 `exampleSite/hugo.yaml` 中找到此站点的配置文件作为开始.
|
||||
Hugo 从 Hugo 网站根目录下的 `hugo.yaml` 读取配置。
|
||||
在配置文件中,您可以配置站点的所有选项。
|
||||
你可以在 `exampleSite/hugo.yaml` 中找到此站点的配置文件作为开始。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## Navigation
|
||||
## 导航栏
|
||||
|
||||
### Menu
|
||||
### 菜单
|
||||
|
||||
右上角的菜单在配置文件的 `menu.main` 中配置:
|
||||
右上角的菜单在配置文件的 `menu.main` 中配置:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
menu:
|
||||
@ -62,18 +63,18 @@ menu:
|
||||
icon: github
|
||||
```
|
||||
|
||||
这些菜单项可以通过设置 `weight` 进行排序.
|
||||
这些菜单项可以通过设置 `weight` 进行排序。
|
||||
|
||||
## 侧边栏
|
||||
|
||||
### 主侧边栏
|
||||
|
||||
主侧边栏是自动从 `content` 目录结构生成的.
|
||||
有关更多详细信息,转至 [目录结构](/docs/guide/organize-files).
|
||||
主侧边栏是自动从 `content` 目录结构生成的。
|
||||
有关更多详细信息,转至 [目录结构](/docs/guide/organize-files)。
|
||||
|
||||
### 额外链接
|
||||
|
||||
侧边栏的额外链接在配置文件的 `menu.sidebar` 部分中配置:
|
||||
侧边栏的额外链接在配置文件的 `menu.sidebar` 部分中配置:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
menu:
|
||||
@ -94,7 +95,7 @@ menu:
|
||||
|
||||
### 目录
|
||||
|
||||
目录是根据内容文件中的标题自动生成的, 可以在 `front matter` 设置 `toc:false` 来禁用它.
|
||||
目录是根据内容文件中的标题自动生成的,可以在 `front matter` 设置 `toc:false` 来禁用它。
|
||||
|
||||
```yaml {filename="content/docs/guide/configuration.md"}
|
||||
---
|
||||
@ -105,15 +106,15 @@ toc: false
|
||||
|
||||
### 编辑此页链接
|
||||
|
||||
要配置编辑此页链接, 我们可以在配置文件中设置 `params.editURL.base`:
|
||||
要配置编辑此页链接,我们可以在配置文件中设置 `params.editURL.base`:
|
||||
```yaml {filename="hugo.yaml"}
|
||||
params:
|
||||
editURL:
|
||||
base: "https://github.com/your-username/your-repo/edit/main"
|
||||
```
|
||||
|
||||
将为每个页面自动生成编辑链接.
|
||||
如需为特定页面设置编辑链接,可以在页面的 `front matter` 中设置 `params.editURL`:
|
||||
将为每个页面自动生成编辑链接。
|
||||
如需为特定页面设置编辑链接,可以在页面的 `front matter` 中设置 `params.editURL`:
|
||||
|
||||
```yaml {filename="content/docs/guide/configuration.md"}
|
||||
---
|
||||
|
@ -1,18 +1,18 @@
|
||||
---
|
||||
title: Diagrams
|
||||
title: 图表
|
||||
weight: 6
|
||||
next: /docs/guide/shortcodes
|
||||
---
|
||||
|
||||
目前, Hextra 支持 [Mermain](#mermaid) 的图表.
|
||||
目前,Hextra 支持 [Mermain](#mermaid) 的图表。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## Mermaid
|
||||
|
||||
[Mermaid](https://github.com/mermaid-js/mermaid#readme) 是一个基于 JavaScript 的图表绘制工具, 它的文本定义和 Markdown 类似, 可在浏览器中动态创建图表. 例如, 流程图、序列图、饼图等
|
||||
[Mermaid](https://github.com/mermaid-js/mermaid#readme) 是一个基于 JavaScript 的图表绘制工具,它的文本定义和 Markdown 类似,可在浏览器中动态创建图表。例如:流程图、序列图、饼图等。
|
||||
|
||||
在 Hextra 中使用 Mermain 就像使用代码块一样简单:
|
||||
在 Hextra 中使用 Mermain 就像使用代码块一样简单:
|
||||
|
||||
````markdown
|
||||
```mermaid
|
||||
@ -24,7 +24,7 @@ graph TD;
|
||||
```
|
||||
````
|
||||
|
||||
将呈现为:
|
||||
将呈现为:
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
@ -34,7 +34,7 @@ graph TD;
|
||||
C-->D;
|
||||
```
|
||||
|
||||
Sequence diagram:
|
||||
Sequence diagram:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
@ -50,4 +50,4 @@ sequenceDiagram
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
如需获取更多信息, 转至 [Mermaid Documentation](https://mermaid-js.github.io/mermaid/#/).
|
||||
如需获取更多信息,转至 [Mermaid Documentation](https://mermaid-js.github.io/mermaid/#/)。
|
||||
|
@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "LaTeX"
|
||||
title: "LaTeX 公式"
|
||||
weight: 4
|
||||
math: true
|
||||
---
|
||||
|
||||
$\KaTeX$ 用于呈现 LaTeX 数学表达式. 可在 `front matter` 将 `math` 设置为 `true` 来启用.
|
||||
$\KaTeX$ 用于呈现 LaTeX 数学表达式。可在 `frontmatter` 将 `math` 设置为 `true` 来启用。
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -13,16 +13,15 @@ $\KaTeX$ 用于呈现 LaTeX 数学表达式. 可在 `front matter` 将 `math`
|
||||
title: "My Page with LaTeX"
|
||||
math: true
|
||||
---
|
||||
|
||||
```
|
||||
|
||||
启用后, KaTeX 中的脚本, 样式表和字体将自动包含在你的网站中. 这样就可以在 Markdown 内容中使用 LaTeX 数学表达式.
|
||||
启用后,KaTeX 中的脚本,样式表和字体将自动包含在你的网站中。这样就可以在 Markdown 内容中使用 LaTeX 数学表达式。
|
||||
|
||||
## 例
|
||||
## 示例
|
||||
|
||||
Markdown 内容中支持内联和单独的 LaTeX 数学表达式.
|
||||
Markdown 内容支持行内和独立段落的 LaTeX 数学表达式。
|
||||
|
||||
### 内联
|
||||
### 行内
|
||||
|
||||
```markdown {filename="page.md"}
|
||||
This $\sigma(z) = \frac{1}{1 + e^{-z}}$ is inline.
|
||||
@ -30,28 +29,28 @@ This $\sigma(z) = \frac{1}{1 + e^{-z}}$ is inline.
|
||||
|
||||
This $\sigma(z) = \frac{1}{1 + e^{-z}}$ is inline.
|
||||
|
||||
### 单独的
|
||||
### 独立段落
|
||||
|
||||
```markdown {filename="page.md"}
|
||||
$$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$$
|
||||
|
||||
|
||||
## 支持的功能
|
||||
|
||||
有关支持的函数列表, 转至 [KaTeX supported functions](https://katex.org/docs/supported.html).
|
||||
有关支持的符号列表,转至 [KaTeX 支持的公式](https://katex.org/docs/supported.html)。
|
||||
|
||||
## 化学表达式
|
||||
|
||||
通过 [mhchem](https://mhchem.github.io/MathJax-mhchem/) 支持化学表达式。
|
||||
|
||||
内联: $\ce{H2O}$ is water.
|
||||
行内:$\ce{H2O}$ 是水。
|
||||
|
||||
单独的:
|
||||
独立段落:
|
||||
|
||||
```markdown {filename="page.md"}
|
||||
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
|
||||
|
@ -3,7 +3,7 @@ title: Markdown
|
||||
weight: 2
|
||||
---
|
||||
|
||||
Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容, 创建列表等. 本页将向你展示一些最常见的 Markdown 语法示例.
|
||||
Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容,创建列表等。本页将向你展示一些最常见的 Markdown 语法示例。
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -21,7 +21,7 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容,
|
||||
|
||||
### 引用
|
||||
|
||||
带角标的块引用:
|
||||
带角标的块引用:
|
||||
|
||||
> Don't communicate by sharing memory, share memory by communicating.<br>
|
||||
> — <cite>Rob Pike[^1]</cite>
|
||||
@ -30,7 +30,7 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容,
|
||||
|
||||
### 表格
|
||||
|
||||
表格并非核心 Markdown 规范, 但 Hugo 支持开箱即用的表格:
|
||||
表格并非核心 Markdown 规范,但 Hugo 支持开箱即用的表格:
|
||||
|
||||
Name | Age
|
||||
--------|------
|
||||
@ -73,19 +73,18 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容,
|
||||
* Milk
|
||||
* Cheese
|
||||
|
||||
### 图像
|
||||
### 图片
|
||||
|
||||

|
||||
|
||||
With caption:
|
||||
带有标题:
|
||||
|
||||

|
||||
|
||||
## 配置
|
||||
|
||||
Hugo 使用 [Goldmark](https://github.com/yuin/goldmark) 解析 Markdown.
|
||||
Markdown 渲染可以在 `hugo.yaml` 中的 `markup.goldmark` 中配置.
|
||||
以下是Hextra的默认配置:
|
||||
Hugo 使用 [Goldmark](https://github.com/yuin/goldmark) 解析 Markdown。
|
||||
Markdown 渲染可以在 `hugo.yaml` 中的 `markup.goldmark` 中配置。以下是Hextra的默认配置:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
markup:
|
||||
@ -96,7 +95,7 @@ markup:
|
||||
noClasses: false
|
||||
```
|
||||
|
||||
如需了解更多选项, 转至 [Configure Markup](https://gohugo.io/getting-started/configuration-markup/).
|
||||
如需了解更多选项,转至 [Configure Markup](https://gohugo.io/getting-started/configuration-markup/)。
|
||||
|
||||
## 参考资料
|
||||
|
||||
|
@ -6,8 +6,8 @@ prev: /docs/guide
|
||||
|
||||
## 目录结构
|
||||
|
||||
默认情况下,Hugo 在 `context` 目录中搜索 Markdown 文件, 目录的结构决定了网站的最终输出结构.
|
||||
以示例网站为例:
|
||||
默认情况下,Hugo 在 `context` 目录中搜索 Markdown 文件,目录的结构决定了网站的最终输出结构。
|
||||
以示例网站为例:
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -29,7 +29,7 @@ prev: /docs/guide
|
||||
{{< /filetree/folder >}}
|
||||
{{< /filetree/container >}}
|
||||
|
||||
每个 `_index.md` 文件都是相应部分的索引页, 其他 Markdown 文件则是常规页面.
|
||||
每个 `_index.md` 文件都是相应部分的索引页,其他 Markdown 文件则是常规页面。
|
||||
|
||||
```
|
||||
content
|
||||
@ -47,7 +47,7 @@ content
|
||||
|
||||
## 侧边栏导航
|
||||
|
||||
侧边栏导航是根据内容组织的字母顺序自动生成的. 要手动配置侧边栏顺序, 可以在 Markdown 文件的 `front matter ` 中使用 `weight` 配置.
|
||||
侧边栏导航是根据内容组织的字母顺序自动生成的。要手动配置侧边栏顺序,可以在 Markdown 文件的 `frontmatter ` 中使用 `weight` 配置。
|
||||
|
||||
```yaml {filename="content/docs/guide/_index.md"}
|
||||
---
|
||||
@ -57,9 +57,9 @@ weight: 2
|
||||
```
|
||||
|
||||
{{< callout emoji="ℹ️">}}
|
||||
建议侧边栏不要太深. 如果内容太多, 请考虑 **将它们分成多个部分**.
|
||||
建议侧边栏不要太深。如果内容太多,请考虑 **将它们分成多个部分**。
|
||||
{{< /callout >}}
|
||||
|
||||
## 配置 `context` 目录
|
||||
## 配置内容目录
|
||||
|
||||
如果需要为的内容使用不同的目录, 可以在站点配置文件中设置 [`contentDir`](https://gohugo.io/getting-started/configuration/#contentdir) 来实现.
|
||||
如果需要为的内容使用不同的目录,可以在站点配置文件中设置 [`contentDir`](https://gohugo.io/getting-started/configuration/#contentdir) 来实现。
|
||||
|
19
exampleSite/content/docs/guide/shortcodes/_index.zh-cn.md
Normal file
19
exampleSite/content/docs/guide/shortcodes/_index.zh-cn.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
title: 短代码
|
||||
weight: 9
|
||||
prev: /docs/guide/diagrams
|
||||
next: /docs/guide/shortcodes/callout
|
||||
---
|
||||
|
||||
[Hugo 短代码](https://gohugo.io/content-management/shortcodes/) 是你的内容文件中调用内置或自定义模板的简单片段。
|
||||
|
||||
Hextra 提供了一系列美观的短代码以增强你的内容。
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="callout" title="注意事项" icon="warning" >}}
|
||||
{{< card link="cards" title="卡片" icon="card" >}}
|
||||
{{< card link="filetree" title="文件树" icon="folder-tree" >}}
|
||||
{{< card link="icon" title="图标" icon="badge-check" >}}
|
||||
{{< card link="steps" title="步骤" icon="one" >}}
|
||||
{{< card link="tabs" title="标签" icon="collection" >}}
|
||||
{{< /cards >}}
|
@ -3,8 +3,8 @@ title: "代码高亮"
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Hugo 使用 [Chroma](https://github.com/alecthomas/chroma),一种纯 Golang 实现的代码高亮渲染器.
|
||||
建议对 Markdown 内容中的代码块使用反引号. 例如:
|
||||
Hugo 使用 [Chroma](https://github.com/alecthomas/chroma),一种纯 Golang 实现的代码高亮渲染器。
|
||||
建议对 Markdown 内容中的代码块使用反引号,例如:
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -26,7 +26,7 @@ def say_hello():
|
||||
|
||||
### 文件名
|
||||
|
||||
要向代码块添加文件名或标题, 请设置 `filename`:
|
||||
要向代码块添加文件名或标题,请设置 `filename`:
|
||||
|
||||
````markdown {filename="Markdown"}
|
||||
```python {filename="hello.py"}
|
||||
@ -42,7 +42,7 @@ def say_hello():
|
||||
|
||||
### 行号
|
||||
|
||||
如需设置行号, 将 `linenos` 设置为 `table` , 并将 `linenostart` 设置为起始行号:
|
||||
如需设置行号,将 `linenos` 设置为 `table`,并将 `linenostart` 设置为起始行号:
|
||||
|
||||
````markdown {filename="Markdown"}
|
||||
```python {linenos=table,linenostart=42}
|
||||
@ -56,9 +56,9 @@ def say_hello():
|
||||
print("Hello!")
|
||||
```
|
||||
|
||||
### 突出显示线条
|
||||
### 高亮行
|
||||
|
||||
要突出显示线条, 设置 `hl_lines` 为行号:
|
||||
显示高亮行,设置 `hl_lines` 为行号:
|
||||
|
||||
````markdown {filename="Markdown"}
|
||||
```python {linenos=table,hl_lines=[2,4],linenostart=1,filename="hello.py"}
|
||||
@ -81,9 +81,9 @@ def main():
|
||||
|
||||
### 复制按钮
|
||||
|
||||
默认情况下, 为代码块启用复制按钮.
|
||||
默认情况下,代码块复制按钮已自动启用。
|
||||
|
||||
|
||||
## 支持的语言
|
||||
## 支持的编程语言
|
||||
|
||||
如需了解支持的语言, 转至 [Chroma's documentation](https://github.com/alecthomas/chroma#supported-languages).
|
||||
如需了解支持的编程语言,转至 [Chroma's documentation](https://github.com/alecthomas/chroma#supported-languages)。
|
||||
|
@ -5,7 +5,7 @@ title: "Hextra"
|
||||
enableRobotsTXT: true
|
||||
enableGitInfo: true
|
||||
# enableEmoji: false
|
||||
# hasCJKLanguage: true
|
||||
hasCJKLanguage: true
|
||||
|
||||
outputs:
|
||||
home: [HTML]
|
||||
|
Loading…
x
Reference in New Issue
Block a user