段落、标题、区块程式码
一个段落是由一个以上的连接的行句组成,而一个以上的空行则会切分出不同的段落(空行的定义是显示上看起来像是空行,就被视為空行,例如有一行只有空白和 tab,那该行也会被视為空行),一般的段落不需要用空白或断行缩排。
Markdown 支援两种标题的语法,[Setext] [1] 和 [atx] [2] 形式。Setext 形式是用底线的形式,利用 = (最高阶标题)和 - (第二阶标题),Atx 形式在行首插入 1 到 6 个 # ,对应到标题 1 到 6 阶。
区块引言则使用 email 形式的 ‘>’ 角括号。
Markdown:
一级标题====================
二级标题---------------------
现在是所有好人来帮助他们国家的时候了。这只是一个常规段落
敏捷的棕色狐狸跳过懒狗的背
### 标题 3
> 这是一个块引用>> 这是第二个块引用>> ## 这是一个H2块引用输出:
<h1>一级标题</h1>
<h2>二级标题</h2>
<p>现在是所有好人来帮助他们国家的时候了。这只是一个常规段落</p>
<p>敏捷的棕色狐狸跳过懒狗的背</p>
<h3>标题</h3>
<blockquote> <p>这是一个块引用</p>
<p>这是第二个块引用</p>
<h2>这是一个H2块引用</h2></blockquote>修辞和强调
Markdown 使用星号和底线来标记需要强调的区段。
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__.输出:
<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.都会输出:
<ul><li>Candy.</li><li>Gum.</li><li>Booze.</li></ul>有序的清单则是使用一般的数字接著一个英文句点作為项目标记:
1. Red2. Green3. Blue输出:
<ol><li>Red</li><li>Green</li><li>Blue</li></ol>如果你在项目之间插入空行,那项目的内容会备用 <p> 包起来,你也可以在一个项目内放上多个段落,只要在它前面缩排 4 个空白或 1 个 tab 。
* A list item.
With multiple paragraphs.
* Another item in the list.输出:
<ul><li><p>A list item.</p><p>With multiple paragraphs.</p></li><li><p>Another item in the list.</p></li></ul>连结
Markdown 支援两种形式的连结语法: 行内 和 参考 两种形式,两种都是使用角括号来把文字转成连结。
行内形式形式是直接在后面用括号直接接上连结:
This is an [example link](http://example.com/).输出:
<p>This is an <a href="http://example.com/">example link</a>.</p>你也可以选择性的加上 title 属性:
This is an [example link](http://example.com/ "With a Title").输出:
<p>This is an <a href="http://example.com/" title="With a Title">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"输出:
<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>title 属性是选择性的,连结名称可以用字母、数字和空格,但是不分大小写:
I start my morning with a cup of coffee and[The New York Times][NY Times].
[ny times]: http://www.nytimes.com/输出:
<p>I start my morning with a cup of coffee and<a href="http://www.nytimes.com/">The New York Times</a>.</p>图片
图片的语法和连结很像。
行内形式(title 是选择性的):
参考形式:
![alt text][id]
[id]: /path/to/img.jpg "Title"上面两种方法都会输出:
<img src="/path/to/img.jpg" alt="alt text" title="Title" />程式码
在一般的段落文字中,你可以使用反引号 ` 来标记程式码区段,区段内的 &、< 和 > 都会被自动的转换成 HTML 实体,这项特性让你可以很容易的在程式码区段内插入 HTML 码:
I strongly recommend against using any `<blink>` tags.
I wish SmartyPants used named entities like `—`instead of decimal-encoded entites like `—`.输出:
<p>I strongly recommend against using any<code><blink></code> tags.</p>
<p>I wish SmartyPants used named entities like<code>&mdash;</code> instead of decimal-encodedentites like <code>&#8212;</code>.</p>如果要建立一个已经格式化好的程式码区块,只要每行都缩排 4 个空格或是一个 tab 就可以了,而 &、< 和 > 也一样会自动转成 HTML 实体。
Markdown:
If you want your page to validate under XHTML 1.0 Strict,you've got to put paragraph tags in your blockquotes:
<blockquote> <p>For example.</p> </blockquote>输出:
<p>If you want your page to validate under XHTML 1.0 Strict,you've got to put paragraph tags in your blockquotes:</p>
<pre><code><blockquote> <p>For example.</p></blockquote></code></pre>部分信息可能已经过时









