这篇文章用于测试 Hugo + PaperMod 的常见 Markdown 渲染效果。English and 中文混排,数字 0123456789。
1. Headings / 标题
文章正文通常从二级标题开始;以下特意展示全部层级。
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
2. Typography / 文字样式
普通文字,粗体 Bold,斜体 Italic,粗斜体,删除线,inline code。
另一组标记:Bold、Italic、加粗链接。
空行分隔段落。这里是一段较长的中英文混排文本,用来检查移动端自动换行、字体、行距、字重和标点。Markdown describes the structure; the theme controls the presentation.
这行结尾有两个空格,应强制换行。
这是同一个段落内的第二行。
3. Lists / 列表
Unordered list
- 第一项
- 第二项:粗体 和
code- 第二层
- 第三层
- 第二层另一项
- 第二层
- 第三项
Ordered list
- 创建文章。
- 编辑内容。
- 设置日期。
- 设置
draft: false。
- 发布。
Task list
- 创建博客
- 发布测试文章
- 检查手机端
- 检查深色模式
Multiple paragraphs in a list
第一项的第一段。
第一项的第二段,保持缩进。
列表内的引用。
第二项。
4. Blockquotes / 引用
第一段引用。
可以包含 粗体、斜体 和 链接。
嵌套引用。
5. Links / 链接
6. Images / 图片
下面是本站的测试图片,不依赖外部图床。
图片说明:检查宽度、深色模式和手机端缩放。
7. Code / 代码
行内代码:hugo --minify。包含反引号:`example`。
Python
from pathlib import Path
def greet(name: str) -> str:
"""Return a friendly message."""
return f"Hello, {name}!"
print(greet("Breathe"))
posts = list(Path("content/posts").glob("*.md"))
print(f"Found {len(posts)} posts")
JavaScript
async function loadPosts() {
const response = await fetch("/index.json");
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response.json();
}
Shell
cd /opt/breathe-blog/site
../bin/hugo new content posts/example.md
/opt/breathe-blog/publish.sh
JSON
{
"title": "Hello",
"draft": false,
"tags": ["Markdown", "Test"]
}
YAML
title: Breathe
params:
defaultTheme: auto
ShowCodeCopyButtons: true
Diff
- draft: true
+ draft: false
Plain text and long lines
No syntax highlighting here.
Long line: abcdefghijklmnopqrstuvwxyz-0123456789-abcdefghijklmnopqrstuvwxyz-0123456789-abcdefghijklmnopqrstuvwxyz-0123456789-abcdefghijklmnopqrstuvwxyz-0123456789
Indented code
This code uses four leading spaces.
<div>This remains text, not HTML.</div>
8. Tables / 表格
| Syntax | Example | Count |
|---|---|---|
| Bold | Strong | 1 |
| Italic | Emphasis | 2 |
| Code | hugo | 3 |
| Escaped pipe | A | B | 4 |
三列分别左对齐、居中、右对齐。
| Column A | Column B | Column C | Column D | Column E |
|---|---|---|---|---|
| Long value for horizontal overflow | Another long value | 1234567890 | 中文长内容测试 | some_long_identifier |
9. Horizontal rules / 分隔线
第一种分隔线:
第二种分隔线:
10. Escaping / 转义
*not italic*,# not a heading,[not a link],_underscore_。
HTML entities:& < > © —。
行内 HTML 源码:<script>alert("test")</script> 应显示为普通文字。
11. Footnotes / 脚注
12. Definition lists / 定义列表
- Markdown
- A lightweight markup language.
- Hugo
- A static site generator.
- Builds this blog from Markdown files.
- PaperMod
- The theme used by Breathe.
13. HTML extensions / HTML 扩展
以下并非纯 Markdown。本站保持 Hugo 默认安全设置,原始 HTML 不会渲染,因此这里展示源码供对照。
<details>
<summary>Click to expand / 点击展开</summary>
This content is inside a collapsible section.
- 支持列表。
- 支持 **粗体**。
</details>
高亮:<mark>highlighted text</mark>。
上标:x<sup>2</sup>。下标:H<sub>2</sub>O。
键盘:<kbd>Ctrl</kbd> + <kbd>C</kbd>。
换行:第一行<br>第二行。
<a id="custom-anchor"></a>
这是自定义锚点的目标位置。
上面的自定义 HTML 锚点当前不会生效。标题自动生成的锚点可正常使用。
14. Extra extensions / 额外扩展
数学公式和 Mermaid 需要额外配置,当前未启用,因此这里仅展示源码。
E = mc^2
\frac{a}{b} = \frac{1}{2}
graph LR
A[Write Markdown] --> B[Build with Hugo]
B --> C[Publish]
15. Rendering checklist / 检查清单
- 标题和目录锚点正确。
- 中英文、数字、标点显示正常。
- 列表缩进、引用、表格对齐正常。
- 代码高亮、复制按钮、长行滚动正常。
- 图片在手机上不会超出页面。
- 脚注跳转和返回正常。
- HTML 扩展以源码显示,符合当前安全配置。
- 深浅色模式都清晰可读。