段落
段落就是被空行分割的文本;空行可以是空格和制表符;并且,正常的段落是没有缩进的;
Markdown的一些属性会影响一段;为了上下内容不被这些属性影响,中间插入空行。
标题
标题有两种格式; Setext 和 atx
Setext 使用等号=
和连字符-
分别定义一级和二级标题;
atx使用#
, 在一行开始加1-6个#分别定义1-6级标题;
引用
使用尖括号>
定义
Markdown:
A First Level Header
====================
A Second Level Header
---------------------
Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.
The quick brown fox jumped over the lazy
dog's back.
### Header 3
> This is a blockquote.
>
> This is the second paragraph in the blockquote.
>
> ## This is an H2 in a blockquote
HTML Output:
<h1>A First Level Header</h1>
<h2>A Second Level Header</h2>
<p>Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.</p>
<p>The quick brown fox jumped over the lazy
dog's back.</p>
<h3>Header 3</h3>
<blockquote>
<p>This is a blockquote.</p>
<p>This is the second paragraph in the blockquote.</p>
<h2>This is an H2 in a blockquote</h2>
</blockquote>
强调-斜体与加粗
星号与下划线用来标记强调;
Markdown:
Some of these words *are emphasized*.
Some of these words _are emphasized also_.
Use two asterisks for **strong emphasis**.
Or, if you prefer, __use two underscores instead__.
HTML Output:
<p>Some of these words <em>are emphasized</em>.
Some of these words <em>are emphasized also</em>.</p>
<p>Use two asterisks for <strong>strong emphasis</strong>.
Or, if you prefer, <strong>use two underscores instead</strong>.</p>
列表
列表分为无序和有序两种;
无序列表:*
,+
, -
标记
* Candy.
* Gum.
* Booze.
+ Candy.
+ Gum.
+ Booze.
- Candy.
- Gum.
- Booze.
HTML Output:
<ul>
<li>Candy.</li>
<li>Gum.</li>
<li>Booze.</li>
</ul>
有序列表使用数字定义:
1. Red
2. Green
3. Blue
HTML Output:
<ol>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ol>
链接
分为内联与引用,都是使用中括号将文本定义为链接;
内联:
This is an [example link](http://example.com/).
HTML Output:
<p>This is an <a href="http://example.com/">
example link</a>.</p>
参考链接:
你可以在任何位置定义好链接,然后引用即可;
I get 10 times more traffic from [Google][1] than from
[Yahoo][2] or [MSN][3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
Output:
<p>I get 10 times more traffic from <a href="http://google.com/"
title="Google">Google</a> than from <a href="http://search.yahoo.com/"
title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
title="MSN Search">MSN</a>.</p>
图片:
内联:
![alt text](/path/to/img.jpg "Title")
参考链接:
![alt text][id]
[id]: /path/to/img.jpg "Title"
代码
反向引号(`)
一对` `标记范围为他们之间;
三对``` ```标记它们之间的整段为代码;
整段标记为代码还可以使用制表符(tab)或四个空格缩进段首即可成功;
表格
第一种表示方法:
| Header | Column1 | Column2 |
| -------|:-------:| -------:|
| Row1 | 1 | 2 |
| Row2 | 2 | 3 |
Header | Column1 | Column2 |
---|---|---|
Row1 | 1 | 2 |
Row2 | 2 | 3 |
第二种表示方法:
Header | Column1 | Column2
-------|:-------:| -------:
Row1 | 1 | 2
Row2 | 2 | 3
Header | Column1 | Column2 |
---|---|---|
Row1 | 1 | 2 |
Row2 | 2 | 3 |
原文:
Markdown: Basics