这只是一个测试.不过文章还是我原创的
本文原文http://www.jianshu.com/p/fdb5cbdaf244 根据个人使用情况有所修改。
Markdown是一种轻量级标记语言,简称md。创始人为约翰·格鲁伯(John Gruber)。它允许人们“使用易读易写的纯文本格式编写文档,然后转换成有效的XHTML(或者HTML)文档”。这种语言吸收了很多在电子邮件中已有的纯文本标记的特性。——维基百科
# 一级标题## 二级标题...###### 六级标题
......
- 无序列表1. 有序列表
> 引用内容
引用内容
**两个星号是粗体***一个星号是斜体*
Hello World!
Hello World!
<http://xhstormr.github.io/>
<XhstormR@foxmail.com>
http://xhstormr.github.io/ XhstormR@foxmail.com
链接直接输入,网址,邮箱用尖括号包着自动就有了。
插入链接有两种方法:一种是行间文字链接,一种是行外文字链接。
[link text](http://example.com/ "optional title")[link text][id]
[id]: http://example.com/ "optional title here"
链接文字内容
[链接文字内容][id] [id]: http://example.com/ "optional title here"
插入图片
![](/path/to/img.jpg "optional title")
[![][jane-eyre-pic]{ImgCap}{/ImgCap}][jane-eyre-douban][jane-eyre-pic]: http://img3.douban.com/mpic/s1108264.jpg
[jane-eyre-douban]: http://book.douban.com/subject/1141406/
如果段落开头使用了tab,会被认为是代码块。
<php> echo “hello world"; </php>
简单地说是用三个“ ` ”加上语言表示,比如javascript,phphtml等等。
行内代码:用点号`引起来就好
Use the `printf()` function.
在一行之内用三个以上的星号,减号,下划线建立分割线,用2个~建立删除线。
```ruby require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html ```
function(){
alert('hello world!')
}
区块引用则使用 email 形式的 '>
' 角括号。
Markdown 语法:
A First Level Header
====================
A Second Level Header
---------------------Now is the time for all good men to come tothe 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.
和减号
- Candy.- Gum.- Booze.
有序的列表则是使用一般的数字接着一个英文句点作为项目标记:
1\. Red
2\. Green
3\. Blue
注意. 本文档的序号都是使用数字\.
的方式写就的。
Markdown 支援两种形式的链接语法: 行内 和 参考 两种形式,两种都是使用角括号来把文字转成连结。
行内形式是直接在后面用括号直接接上链接:
This is an [example link](http://example.com/).
This is an example link.
你也可以选择性的加上 title 属性:
This is an [example link](http://example.com/ "With a Title").
This is an example link.(悬停会有提示,看编辑器而定)
参考形式的链接让你可以为链接定一个名称,之后你可以在文件的其他地方定义该链接的内容:
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"
图片的语法和链接很像。
行内形式(title 是选择性的):
![](图片路径 "Title"){ImgCap}alt text{/ImgCap}
行外注脚形式:
![][id]{ImgCap}alt text{/ImgCap}[id]: /path/to/img.jpg "Title"
在一般的段落文字中,你可以使用反引号 ``来标记代码区段,区段内的
&、
<和
>` 都会被自动的转换成 HTML 实体,这项特性让你可以很容易的在代码区段内插入 HTML 码:
I strongly recommend against using any `<blink>` tags.I wish SmartyPants used named entities like `—`
instead of decimal-encoded entites like `—`.
如果要建立一个已经格式化好的代码区块,只要每行都缩进 4 个空格或是一个 tab 就可以了,而 &
、<
和 >
也一样会自动转成 HTML 实体。