Markdown語法

Qiandu 支援 Markdown 來書寫內容,建立清單等。本頁將向你展示一些Qiandu所使用的最常見 Markdown 語法範例。

Markdown 基礎

文字樣式

StyleSyntaxExampleOutput
Bold**bold text****bold text**bold text
Italic*italicized text*`italicized textitalicized text
Strikethrough~~strikethrough text~~~~strikethrough text~~strikethrough text
Subscript<sub></sub>This is a <sub>subscript</sub> textThis is a subscript text
Superscript<sup></sup>This is a <sup>superscript</sup> textThis is a superscript text

引用

有角標的區塊引用:

Don’t communicate by sharing memory, share memory by communicating.
Rob Pike1

Markdown
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>

[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.

表格

表格並非核心 Markdown 規範,但 Hugo 支援開箱即用的表格:

NameAge
Bob27
Alice23
Markdown
|   Name | Age  |
|--------|------|
|    Bob | 27   |
|  Alice | 23   |

Markdown 表格中的內聯

ItalicsBoldCode
italicsboldcode
Markdown
| Italics   | Bold     | Code   |
| --------  | -------- | ------ |
| *italics* | **bold** | `code` |

程式碼區塊

列表

有序列表

  1. First item
  2. Second item
  3. Third item
Markdown
1. First item
2. Second item
3. Third item

無序列表

  • List item
  • Another item
  • And another item
Markdown
* List item
* Another item
* And another item

巢狀列表

  • Fruit
    • Apple
    • Orange
    • Banana
  • Dairy
    • Milk
    • Cheese
Markdown
* Fruit
  * Apple
  * Orange
  * Banana
* Dairy
  * Milk
  * Cheese

圖片

landscape

Markdown
![landscape](https://picsum.photos/800/600)

帶有標題:

landscape
Unsplash Landscape

Markdown
![landscape](https://picsum.photos/800/600 "Unsplash Landscape")

配置

Qiandu使用 Goldmark 解析 Markdown。 Markdown 渲染可以聯絡社群管理員在 hugo.yaml 中的 markup.goldmark 中設定。以下是Qiandu的預設配置:

hugo.yaml
markup:
  goldmark:
    renderer:
      unsafe: true
  highlight:
    noClasses: false

如欲了解更多選項,請前往 Configure Markup

MD參考資料


  1. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015. ↩︎