Markdown 语法简明笔记

目录

提示

  • Markdown 中可以插入HTML,但HTML标签前后需空行且不能缩进或空格。
  • 输入&自动转换成&,两者现实效果一致,还有© 等于 ©。

标题 (#)

text
# 这是 H1
## 这是 H2
......
###### 这是 H6

引用 (>)

text
> 引用里面可以插入其他Markdown,也可互相嵌套。

无序列表 (-)

text
- Red
- Green
- Blue

有序列表 (数字)

text
1.  Bird
2.  McHale
3.  Parish

列表嵌套 (四个空格)

text
- 一级列表2
    - 二级列表
- 一级列表2
    - 二级列表
        - 三级列表

代码块

支持的语言:actionscript, apache, bash, clojure, cmake, coffeescript, cpp, cs, css, d, delphi, django, erlang, go, haskell, html, http, ini, java, javascript, json, lisp, lua, markdown, matlab, nginx, objectivec, perl, php, python, r, ruby, scala, smalltalk, sql, tex, vbscript, xml

也可以使用 4 空格缩进,再贴上代码,实现相同的的效果

分割线 (—)

text
三个或更多的 --- 号

行内式链接

text
[an example](http://example.com/ "Title") 
[About](/about/) //相对地址

参考式链接 (有标识)

text
这个链接用 1 作为网址变量。
[example][1]
[1]: http://example.com/

参考式链接 (隐藏标识)

text
[google][]
[google]: http://google.com/

粗体和斜体

text
** 粗体 ** 
* 斜体 *

代码 (``)

text
Use the `printf()` function.

Use the printf() function.

图片 (行内式)

text
![Alt text](/path/to/img.jpg "Optional title") //与链接的区别在于有感叹号

图片 (参考式)

text
![Alt text][id] //有感叹号
[id]: url/to/image

自动链接

text
<http://example.com/>
<address@example.com>

反斜杠

text
\*literal asterisks\*

Markdown 支持以下这些符号前面加上反斜杠来帮助插入普通的符号:

text
反斜线 反引号 星号 下划线 花括号 方括号 
括号 井字号 加号 减号 英文句点 惊叹号
ESC