Featured image of post Markdown语法指南

Markdown语法指南

示例文章展示基本的 Markdown 语法和 HTML 元素的格式化。

本文提供了一个可用于 Hugo 内容文件的基本 Markdown 语法示例,同时还展示了 Hugo 主题中基本 HTML 元素是否被 CSS 装饰。

标题

以下 HTML <h1><h6> 元素表示六级标题。<h1> 是最高级别的标题,而 <h6> 是最低级别的标题。

H1

H2

H3

H4

H5
H6

段落

这里可以放一段话

这样换行两次是新开一段

引用块

引用块 (blockquote) 元素表示引用自其他来源的内容,可以选择性地带有引用来源,这些引用必须放在 footercite 元素中,并且可以选择性地带有行内修改,如注释和缩写。

引用段落(未注明来源)

Tiam, ad mint andaepu dandae nostion secatur sequo quae. 注意你可以在引用块中使用Markdown语法

带出处的引用

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

表格

表格不是核心 Markdown 规范的一部分, 但是 Hugo 支持使用。

Name Age
Bob 27
Alice 23

表格内的内联 Markdown

Italics Bold Code
italics bold code
A B C D E F
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultricies, sapien non euismod aliquam, dui ligula tincidunt odio, at accumsan nulla sapien eget ex. Proin eleifend dictum ipsum, non euismod ipsum pulvinar et. Vivamus sollicitudin, quam in pulvinar aliquam, metus elit pretium purus Proin sit amet velit nec enim imperdiet vehicula. Ut bibendum vestibulum quam, eu egestas turpis gravida nec Sed scelerisque nec turpis vel viverra. Vivamus vitae pretium sapien

代码块

带反引号的代码块

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Example HTML5 Document</title>
</head>
<body>
  <p>Test</p>
</body>
</html>

缩进四个空格的代码块

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Example HTML5 Document</title>
</head>
<body>
  <p>Test</p>
</body>
</html>

使用 Hugo 内置 highlight shortcode 的代码块

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Example HTML5 Document</title>
</head>
<body>
  <p>Test</p>
</body>
</html>

Diff 代码块

1
2
3
4
5
[dependencies.bevy]
git = "https://github.com/bevyengine/bevy"
rev = "11f52b8c72fc3a568e8bb4a4cd1f3eb025ac2e13"
- features = ["dynamic"]
+ features = ["jpeg", "dynamic"]

列表类型

有序列表

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

无序列表

  • List item
  • Another item
  • And another item

嵌套列表

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

其他元素 — abbr, sub, sup, kbd, mark

GIF 是一种位图图像格式。

H2O

Xn + Yn = Zn

按下 CTRL + ALT + Delete 以结束会话。

大多数 蝾螈 是夜行性的,以昆虫、蠕虫和其他小型生物为食。

超链接图片

Google


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

使用 Hugo 构建
主题 StackJimmy 设计