Markdown
Markdown 是什么?
Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成有效的 HTML(或其他格式)。Markdown 语法简洁明了、学习容易,而且功能比纯文本更强,因此有很多人用它来写博客。世界上最流行的博客平台 GitHub 和许多其他平台都支持 Markdown。
Markdown 的基本语法
标题
在 Markdown 中,可以使用 #
符号来表示标题。例如:
# 一级标题## 二级标题### 三级标题
段落
在 Markdown 中,段落是由一个或多个连续的文本行组成,不需要任何特殊的标记。例如:
这是一个段落。这是另一个段落。
强调
在 Markdown 中,可以使用 *
或 _
符号来表示强调。例如:
*斜体文本*_斜体文本_**粗体文本**__粗体文本__
列表
在 Markdown 中,可以使用 -
、+
或 *
符号来表示无序列表,使用数字和点号来表示有序列表。例如:
- 无序列表项 1- 无序列表项 2- 无序列表项 3
1. 有序列表项 12. 有序列表项 23. 有序列表项 3
链接
在 Markdown 中,可以使用 [链接文本](链接地址)
的语法来插入链接。例如:
[百度](https://www.baidu.com)
图片
在 Markdown 中,可以使用 
的语法来插入图片。例如:

代码块
在 Markdown 中,可以使用反引号(`)来表示代码块。例如:
`这是一个代码块`
引用
在 Markdown 中,可以使用 >
符号来表示引用。例如:
> 这是一个引用
表格
在 Markdown 中,可以使用以下语法来表示表格:
| 标题1 | 标题2 | 标题3 ||-------|-------|-------|| 内容1 | 内容2 | 内容3 || 内容4 | 内容5 | 内容6 |
Markdown 的扩展语法
代码块
在 Markdown 中,可以使用三个反引号(```)来表示代码块。例如:
```pythondef hello_world(): print("Hello, world!")
### 表格
在 Markdown 中,可以使用以下语法来表示表格:
# An h1 header
Paragraphs are separated by a blank line.
2nd paragraph. _Italic_, **bold**, and `monospace`. Itemized listslook like:
- this one- that one- the other one
Note that --- not considering the asterisk --- the actual textcontent starts at 4-columns in.
> Block quotes are> written like so.>> They can span multiple paragraphs,> if you like.
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's allin chapters 12--14"). Three dots ... will be converted to an ellipsis.Unicode is supported. ☺
## An h2 header
Here's a numbered list:
1. first item2. second item3. third item
Note again how the actual text starts at 4 columns in (4 charactersfrom the left side). Here's a code sample:
# Let me re-iterate ... for i in 1 .. 10 { do-something(i) }
As you probably guessed, indented 4 spaces. By the way, instead ofindenting the block, you can use delimited blocks, if you like:
define foobar() { print “Welcome to flavor country!”; }
(which makes copying & pasting easier). You can optionally mark thedelimited block for Pandoc to syntax highlight it:
```pythonimport time# Quick, count to ten!for i in range(10): # (but not *too* quick) time.sleep(0.5) print i
An h3 header
Now a nested list:
-
First, get these ingredients:
- carrots
- celery
- lentils
-
Boil some water.
-
Dump everything in the pot and follow this algorithm:
find wooden spoonuncover potstircover potbalance wooden spoon precariously on pot handlewait 10 minutesgoto first step (or shut off burner when done)Do not bump wooden spoon or it will fall.
Notice again how text always lines up on 4-space indents (including that last line which continues item 3 above).
Here’s a link to a website, to a local doc, and to a section heading in the current doc. Here’s a footnote 1.
Tables can look like this:
size material color
9 leather brown 10 hemp canvas natural 11 glass transparent
Table: Shoes, their sizes, and what they’re made of
(The above is the caption for the table.) Pandoc also supports multi-line tables:
keyword text
red Sunsets, apples, and other red or reddish things.
green Leaves, grass, frogs and other things it’s not easy being.
A horizontal rule follows.
Here’s a definition list:
apples : Good for making applesauce. oranges : Citrus! tomatoes : There’s no “e” in tomatoe.
Again, text is indented 4 spaces. (Put a blank line between each term/definition pair to spread things out more.)
Here’s a “line block”:
| Line one | Line too | Line tree
and images can be specified like so:
Inline math equations go in like so:
And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: `foo`, *bar*, etc.
Footnotes
-
Footnote text goes here. ↩