mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 23:56:35 -04:00
docs(blog): prepare for v0.10 release post (#746)
* docs(blog): prepare for v0.10 release post * Update v0.10.md * Update v0.10.md to refine upgrade instructions and enhance blog features. Added synchronized tab switching and pagination controls, while improving the search experience and table of contents navigation. * Enhance v0.10 release documentation with detailed upgrade instructions and migration guide. Added Tailwind theme variable customization section and clarified breaking changes. Improved clarity on CSS class prefix changes for better user experience. * Update v0.10.md to enhance upgrade instructions, clarify breaking changes, and improve overall readability. Adjusted formatting for consistency and added details on asset management and user experience improvements. * Add notable new features to v0.10.md, including dropdown menu support, enhanced search experience, and blog list pagination. Updated FlexSearch upgrade details for clarity and improved migration guide by removing redundant breaking change notes. * chore: update zh-cn translation * chore: update ja translation * chore: update fa and ja translations * chore: prepare release
This commit is contained in:
@@ -3,8 +3,7 @@ title: "语法高亮"
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Hugo 使用 [Chroma](https://github.com/alecthomas/chroma),这是一个用纯 Go 编写的通用语法高亮器,用于语法高亮。
|
||||
建议在 Markdown 内容中使用反引号来标记代码块。例如:
|
||||
Hugo 使用纯 Go 编写的通用语法高亮工具 [Chroma](https://github.com/alecthomas/chroma) 来实现代码高亮。建议在 Markdown 内容中使用反引号标记代码块,例如:
|
||||
|
||||
<!--more-->
|
||||
|
||||
@@ -15,18 +14,18 @@ def say_hello():
|
||||
```
|
||||
````
|
||||
|
||||
将会渲染为:
|
||||
将渲染为:
|
||||
|
||||
```python
|
||||
def say_hello():
|
||||
print("Hello!")
|
||||
```
|
||||
|
||||
## 功能
|
||||
## 功能特性
|
||||
|
||||
### 文件名
|
||||
### 文件名标注
|
||||
|
||||
要为代码块添加文件名或标题,请设置 `filename` 属性:
|
||||
通过设置 `filename` 属性可为代码块添加文件名或标题:
|
||||
|
||||
````markdown {filename="Markdown"}
|
||||
```python {filename="hello.py"}
|
||||
@@ -44,9 +43,7 @@ def say_hello():
|
||||
|
||||
{{< new-feature version="v0.9.2" >}}
|
||||
|
||||
你可以使用 `base_url` 属性提供一个基础 URL,它将与文件名结合生成一个链接。
|
||||
|
||||
如果文件名指定了文件在基础路径中的位置,则可以包含相对路径。
|
||||
通过 `base_url` 属性可设置基础 URL,该 URL 会与文件名组合生成可点击的链接。文件名可包含相对路径以指定文件在基础路径中的位置。
|
||||
|
||||
````markdown {filename="Markdown"}
|
||||
```go {base_url="https://github.com/imfing/hextra/blob/main/",filename="exampleSite/hugo.work"}
|
||||
@@ -58,9 +55,9 @@ go 1.20
|
||||
go 1.20
|
||||
```
|
||||
|
||||
### 行号
|
||||
### 行号显示
|
||||
|
||||
要设置行号,请将 `linenos` 属性设置为 `table`,并可选地设置 `linenostart` 为起始行号:
|
||||
设置 `linenos=table` 可启用行号,并通过 `linenostart` 指定起始行号:
|
||||
|
||||
````markdown {filename="Markdown"}
|
||||
```python {linenos=table,linenostart=42}
|
||||
@@ -74,9 +71,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"}
|
||||
@@ -98,7 +95,7 @@ def main():
|
||||
|
||||
### 复制按钮
|
||||
|
||||
默认情况下,代码块启用了复制按钮。可以通过修改站点配置文件来更改其行为:
|
||||
代码块默认启用复制功能,可通过站点配置文件修改其行为:
|
||||
|
||||
```yaml {linenos=table,linenostart=42,filename="hugo.yaml"}
|
||||
params:
|
||||
@@ -109,6 +106,6 @@ params:
|
||||
display: hover
|
||||
```
|
||||
|
||||
## 支持的语言
|
||||
## 支持语言
|
||||
|
||||
有关支持的语言列表,请参阅 [Chroma 文档](https://github.com/alecthomas/chroma#supported-languages)。
|
||||
完整支持的语言列表请参阅 [Chroma 文档](https://github.com/alecthomas/chroma#supported-languages)。
|
Reference in New Issue
Block a user