Markdown: Basics (快速入门)

Markdown如今做为写blog的标记语言愈来愈流行,github和oschina都支持,因而也学习一下。html

#段落、标题、区块代码git

一个段落是由一个以上的链接的行句组成,而一个以上的空行则会划分出不一样的段落(空行的定义是显示上看起来像是空行,就被视为空行,例若有一行只有空白和 tab,那该行也会被视为空行),通常的段落不须要用空白或换行缩进。github

Markdown 支持两种标题的语法,Setextatx 形式。Setext 形式是用底线的形式,利用 = (最高阶标题)和 - (第二阶标题),Atx 形式在行首插入 1 到 6 个 # ,对应到标题 1 到 6 阶。ubuntu

区块引用则使用 email 形式的 '>' 角括号。markdown

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

显示效果为:ui

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.google

The quick brown fox jumped over the lazy dog's back..net

Header 3

This is a blockquote.code

This is the second paragraph in the blockquote.

This is an H2 in a 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__.

显示效果为:

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.

#列表

无序列表使用星号、加号和减号来作为列表的项目标记,这些符号是均可以使用的,使用星号:

* Candy.
* Gum.
* Booze.

显示效果为:

  • Candy.
  • Gum.
  • Booze.

有序的列表则是使用通常的数字接着一个英文句点做为项目标记:

1. Red
2. Green
3. Blue

显示效果为:

  1. Red
  2. Green
  3. Blue

#连接

Markdown 支援两种形式的连接语法: 行内 和 参考 两种形式,两种都是使用角括号来把文字转成连结。

行内形式是直接在后面用括号直接接上连接:

This is [github](http://github.com/ "github").

显示效果为:

This is github.

参考形式的连接让你能够为连接定一个名称,以后你能够在文件的其余地方定义该连接的内容:

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"
[msn]: http://search.msn.com/ "MSN Search"

显示效果为:

I get 10 times more traffic from Google than from Yahoo or MSN.

title 属性是选择性的,连接名称能够用字母、数字和空格,可是不分大小写:

#图片

图片的语法和连接很像。

行内形式(title 是选择性的):

![个人头像](http://static.oschina.net/uploads/user/53/106378_50.jpg "Title")

显示效果为:

个人头像

#代码

在通常的段落文字中,你可使用反引号 ` 来标记代码区段,区段内的 &、< 和 > 都会被自动的转换成 HTML 实体,这项特性让你能够很容易的在代码区段内插入 HTML 码:

I strongly recommend against using any `<blink>` tags.

I wish SmartyPants used named entities like `&mdash;`
instead of decimal-encoded entites like `&#8212;`.

显示效果为:

I strongly recommend against using any <blink> tags.

I wish SmartyPants used named entities like &mdash; instead of decimal-encoded entites like &#8212;.

若是要创建一个已经格式化好的代码区块,只要每行都缩进 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>

显示效果为:

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>

Refers:

  1. http://wowubuntu.com/markdown/basic.html
  2. http://jianshu.io/p/q81RER
  3. http://www.ituring.com.cn/article/23
  4. http://www.oschina.net/question/100267_75314

本文的Markdown以下:

Markdown如今做为写blog的标记语言愈来愈流行,[github][github]和oschina都支持,因而也学习一下。

#段落、标题、区块代码

一个段落是由一个以上的链接的行句组成,而一个以上的空行则会划分出不一样的段落(空行的定义是显示上看起来像是空行,就被视为空行,例若有一行只有空白和 tab,那该行也会被视为空行),通常的段落不须要用空白或换行缩进。

Markdown 支持两种标题的语法,[Setext][Setext] 和 [atx][atx] 形式。Setext 形式是用底线的形式,利用 = (最高阶标题)和 - (第二阶标题),Atx 形式在行首插入 1 到 6 个 # ,对应到标题 1 到 6 阶。

区块引用则使用 email 形式的 '>' 角括号。

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

显示效果为:

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

#修辞和强调

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__.

显示效果为:

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__.

#列表

无序列表使用星号、加号和减号来作为列表的项目标记,这些符号是均可以使用的,使用星号:

	* Candy.
	* Gum.
	* Booze.

显示效果为:

* Candy.
* Gum.
* Booze.

有序的列表则是使用通常的数字接着一个英文句点做为项目标记:

	1. Red
	2. Green
	3. Blue

显示效果为:

1. Red
2. Green
3. Blue

#连接

Markdown 支援两种形式的连接语法: 行内 和 参考 两种形式,两种都是使用角括号来把文字转成连结。

行内形式是直接在后面用括号直接接上连接:

	This is [github](http://github.com/ "github").

显示效果为:

This is [github](http://github.com/ "github").

参考形式的连接让你能够为连接定一个名称,以后你能够在文件的其余地方定义该连接的内容:

	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"
	[msn]: http://search.msn.com/ "MSN Search"

显示效果为:

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"
[msn]: http://search.msn.com/ "MSN Search"

title 属性是选择性的,连接名称能够用字母、数字和空格,可是不分大小写:

#图片

图片的语法和连接很像。

行内形式(title 是选择性的):

	![个人头像](http://static.oschina.net/uploads/user/53/106378_50.jpg "Title")

显示效果为:

![个人头像](http://static.oschina.net/uploads/user/53/106378_50.jpg "Title")


#代码

在通常的段落文字中,你可使用反引号 ` 来标记代码区段,区段内的 &、< 和 > 都会被自动的转换成 HTML 实体,这项特性让你能够很容易的在代码区段内插入 HTML 码:

	I strongly recommend against using any `<blink>` tags.
	
	I wish SmartyPants used named entities like `&mdash;`
	instead of decimal-encoded entites like `&#8212;`.

显示效果为:

I strongly recommend against using any `<blink>` tags.

I wish SmartyPants used named entities like `&mdash;`
instead of decimal-encoded entites like `&#8212;`.

若是要创建一个已经格式化好的代码区块,只要每行都缩进 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>

显示效果为:

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>



Refers:
1. [http://wowubuntu.com/markdown/basic.html](http://wowubuntu.com/markdown/basic.html)
2. [http://jianshu.io/p/q81RER](http://jianshu.io/p/q81RER)
3. [http://www.ituring.com.cn/article/23](http://www.ituring.com.cn/article/23)
4. [http://www.oschina.net/question/100267_75314](http://www.oschina.net/question/100267_75314)


[github]: http://github.com
[Setext]: http://docutils.sourceforge.net/mirror/setext.html
[atx]: http://www.aaronsw.com/2002/atx/
相关文章
相关标签/搜索