Markdown is a lightweight markup language built for writing in plain text that remains easy to read and edit. John Gruber created it in 2004. A Markdown file usually ends in .md or .markdown, and from that source you can produce HTML, Word documents, images, PDFs, EPUB files, and other formats. It is common in ebooks such as GitBook, and in help documentation and forum posts across sites including GitHub, Jianshu, Reddit, Diaspora, Stack Exchange, OpenStreetMap, and SourceForge. The smallest example is a heading:
# Hello World!
Headings
Start a line with one to six # characters. One hash gives a level-one heading, two gives level two, and so on through level six.
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题
Paragraphs and inline styling
Paragraphs need no special marker: write the text directly. A hard line break comes from putting two or more spaces at the end of a line and then pressing Enter.
For emphasis, one * or _ wraps italic text, two wrap bold, and three wrap bold italic:
*斜体文字*
_斜体文字_
**粗体文字**
__粗体文字__
***粗斜体文字***
___粗斜体文字___
A horizontal rule can be made from three or more asterisks, minus signs, or underscores on a line by themselves. Spaces may be inserted between the characters, but nothing else should share the line:
***
* * *
******
- - -
------
Strikethrough uses two tilde characters on each side:
baidu.com
sina.com
~~tencent.com~~
Underline is not native Markdown syntax; use the HTML tag instead:
<u>带下划线文本</u>
Footnotes provide extra explanation. The form is:
[^要注明的文本]:
Lists
Unordered lists accept *, +, or - as the bullet marker:
* 第一项
* 第二项
* 第三项
+ 第一项
+ 第二项
+ 第三项
- 第一项
- 第二项
- 第三项
Ordered lists use 1., 2., 3., and so on, with a space between the marker and the text:
1. 第一项
2. 第二项
3. 第三项
To nest a list, indent the child items by four spaces:
1. 第一项:
- 第一项嵌套的第一个元素
- 第一项嵌套的第二个元素
2. 第二项:
- 第二项嵌套的第一个元素
- 第二项嵌套的第二个元素
Blockquotes
A blockquote starts with > followed by a space. Add another > for each level of nesting:
> 区块引用
> Markdown教程
> 学的不仅是技术更是梦想
> 最外层
>> 第一层嵌套
>>> 第二层嵌套
Lists can live inside a blockquote:
> 区块中使用列表
> 1. 第一项
> 2. 第二项
> + 第一项
> + 第二项
> + 第三项
A blockquote can also sit inside a list item; indent it by four spaces before the >:
* 第一项
> Markdown教程
> 学的不仅是技术更是梦想
* 第二项
Code
Inline code is written with backticks, as in print().
For a code block, indent each line with four spaces or a tab:
<?Python
print('Markdown')
def test():
print('Markdown test!')
A fenced code block uses three backticks and can name the language after the opening fence:
$(document).read(function(){
alert('Markdown');
});
Links
The basic link forms are:
[链接名称](链接地址)
或者
<链接地址>
For example:
这是一个链接 [新浪新闻](https://news.sina.com.cn/)
<https://news.sina.com.cn/>
Reference-style links let you put the URL elsewhere, often at the end of the document:
链接也可以用变量来代替,文档末尾附带变量地址:
这个链接用1作为网址变量[baidu][1]
这个链接用markdown作为网址变量[Markdown][markdown]
然后文档的结尾为变量赋值(网址)
[1]: http://www.baidu.com
[markdown]: http://www.markdown.com
Images
The image syntax begins with an exclamation mark, then alt text in square brackets, then the image URL in parentheses. An optional title can follow the URL in quotes:


For example:

---


Images can also use reference variables:
这个图片链接用1作为网址变量[zhihu][1]
然后在文档的结尾为变量赋值(网址)
[1]: (https://pic4.zhimg.com/80/v2-a47051e92cf74930bedd7469978e6c08_hd.png)
Markdown itself does not set image width or height. When dimensions matter, use an HTML img tag:
<img src=“https://pic4.zhimg.com/80/v2-a47051e92cf74930bedd7469978e6c08_hd.png” width=10%>
Tables
A table uses pipes to separate cells and hyphens to separate the header from the body:
|表头1|表头2|
|----|----|
|单元格11|单元格12|
|单元格21|单元格22|
Alignment is controlled with colons in the separator row: -: right, :- left, :-: center.
|左对齐|居中对齐|右对齐|
|:----|:----:|----:|
|单元格11|单元格12|单元格13|
|单元格21|单元格22|单元格23|
HTML, escapes, and math
Markdown allows raw HTML for tags it does not cover directly. A keyboard example:
使用<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Del</kbd>重启电脑
Markdown reserves many characters for syntax. To show one literally, put a backslash before it:
**文本加粗**
\*\*正常显示星号\*\*
The backslash can escape characters such as the backslash itself, backtick, asterisk, underscore, braces, brackets, parentheses, hash, plus, minus, period, and exclamation mark.
For TeX or LaTeX math, wrap the expression in two dollar signs:
$$
\int_0^1 {x^2} \,{\rm d}x
$$