|
| 1 | +--- |
| 2 | +title: Markdown 语法指南 |
| 3 | +date: 2023-02-11 |
| 4 | +author: Hugo Authors |
| 5 | +description: 展示基本 Markdown 语法和 HTML 元素格式化的示例文章。 |
| 6 | +isStarred: true |
| 7 | +--- |
| 8 | + |
| 9 | +本文提供了 Hugo 内容文件中可以使用的 Markdown 语法示例,同时展示了 Hugo 主题中是否对基本 HTML 元素进行了 CSS 装饰。 |
| 10 | +<!--more--> |
| 11 | + |
| 12 | +## 标题 |
| 13 | + |
| 14 | +以下 HTML `<h1>`—`<h6>` 元素表示六个级别的标题。`<h1>` 是最高级别的标题,而 `<h6>` 是最低级别的标题。 |
| 15 | + |
| 16 | +# H1 |
| 17 | + |
| 18 | +## H2 |
| 19 | + |
| 20 | +### H3 |
| 21 | + |
| 22 | +#### H4 |
| 23 | + |
| 24 | +##### H5 |
| 25 | + |
| 26 | +###### H6 |
| 27 | + |
| 28 | +## 段落 |
| 29 | + |
| 30 | +Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat. |
| 31 | + |
| 32 | +Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat. |
| 33 | + |
| 34 | +## 图片 |
| 35 | + |
| 36 | +您可以使用以下语法来包含图片。图片的路径应相对于 `index.md` 文件。 |
| 37 | + |
| 38 | +```markdown |
| 39 | + |
| 40 | +``` |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +您还可以包含来自外部来源的图片。 |
| 45 | + |
| 46 | +```markdown |
| 47 | + |
| 48 | +``` |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +## 引用 |
| 53 | + |
| 54 | +引用元素表示从其他来源引用的内容,可以选择包含引用来源,引用来源必须位于 `footer` 或 `cite` 元素中,还可以选择包含注释和缩写等内联更改。 |
| 55 | + |
| 56 | +### 无来源的引用 |
| 57 | + |
| 58 | +> 您可以在引用中使用 Markdown 语法,例如 **bold**, _italics_, [links](https://gohugo.io/), `code`。 |
| 59 | +
|
| 60 | +### 带来源的引用 |
| 61 | + |
| 62 | +> Don't communicate by sharing memory, share memory by communicating.<br> |
| 63 | +> — <cite>Rob Pike[^1]</cite> |
| 64 | +
|
| 65 | +[^1]: 上述引用摘自 Rob Pike 在 2015 年 11 月 18 日 Gopherfest 上的[演讲](https://www.youtube.com/watch?v=PAAkCSZUG1c)。 |
| 66 | + |
| 67 | +## 表格 |
| 68 | + |
| 69 | +表格不是 Markdown 核心规范的一部分,但 Hugo 原生支持它们。 |
| 70 | + |
| 71 | + Name | Age |
| 72 | +--------|------ |
| 73 | + Bob | 27 |
| 74 | + Alice | 23 |
| 75 | + |
| 76 | +### 表格中的 Markdown |
| 77 | + |
| 78 | +| Italics | Bold | Code | |
| 79 | +| -------- | -------- | ------ | |
| 80 | +| *italics* | **bold** | `code` | |
| 81 | + |
| 82 | +## 代码块 |
| 83 | + |
| 84 | +### 使用反引号的代码块 |
| 85 | + |
| 86 | +```html |
| 87 | +<!doctype html> |
| 88 | +<html lang="en"> |
| 89 | +<head> |
| 90 | + <meta charset="utf-8"> |
| 91 | + <title>Example HTML5 Document</title> |
| 92 | +</head> |
| 93 | +<body> |
| 94 | + <p>Test</p> |
| 95 | +</body> |
| 96 | +</html> |
| 97 | +``` |
| 98 | + |
| 99 | +### 缩进四个空格的代码块 |
| 100 | + |
| 101 | + <!doctype html> |
| 102 | + <html lang="en"> |
| 103 | + <head> |
| 104 | + <meta charset="utf-8"> |
| 105 | + <title>Example HTML5 Document</title> |
| 106 | + </head> |
| 107 | + <body> |
| 108 | + <p>Test</p> |
| 109 | + </body> |
| 110 | + </html> |
| 111 | + |
| 112 | +### 使用 Hugo 内置高亮短代码的代码块 |
| 113 | + |
| 114 | +{{< highlight html >}} |
| 115 | +<!doctype html> |
| 116 | +<html lang="en"> |
| 117 | +<head> |
| 118 | + <meta charset="utf-8"> |
| 119 | + <title>Example HTML5 Document</title> |
| 120 | +</head> |
| 121 | +<body> |
| 122 | + <p>Test</p> |
| 123 | +</body> |
| 124 | +</html> |
| 125 | +{{< /highlight >}} |
| 126 | + |
| 127 | +### 内联代码 |
| 128 | + |
| 129 | +使用反引号在句子中引用 `variable`。 |
| 130 | + |
| 131 | +## 列表类型 |
| 132 | + |
| 133 | +### 有序列表 |
| 134 | + |
| 135 | +1. First item |
| 136 | +2. Second item with some `code` in it |
| 137 | +3. Third item |
| 138 | + |
| 139 | +### 无序列表 |
| 140 | + |
| 141 | +* List item |
| 142 | +* Another item with some `code` in it |
| 143 | +* And another item |
| 144 | + |
| 145 | +### 嵌套列表 |
| 146 | + |
| 147 | +* Fruit |
| 148 | + * Apple |
| 149 | + * Orange |
| 150 | + * Banana |
| 151 | +* Dairy |
| 152 | + * Milk |
| 153 | + * Cheese |
| 154 | + |
| 155 | +## 其他元素 — abbr, sub, sup, kbd, mark |
| 156 | + |
| 157 | +<abbr title="Graphics Interchange Format">GIF</abbr> 是一种位图图像格式。 |
| 158 | + |
| 159 | +H<sub>2</sub>O |
| 160 | + |
| 161 | +X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup> |
| 162 | + |
| 163 | +按下 <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> 结束会话。 |
| 164 | + |
| 165 | +大多数 <mark>蝾螈</mark> 是夜行动物,捕食昆虫、蠕虫和其他小生物。 |
0 commit comments