Markdown是一種輕量級(jí)標(biāo)記語(yǔ)言批旺,創(chuàng)始人為約翰·格魯伯(John Gruber)统倒。它允許人們“使用易讀易寫(xiě)的純文本格式編寫(xiě)文檔,然后轉(zhuǎn)換成有效的XHTML(或者HTML)文檔”澎剥。這種語(yǔ)言吸收了很多在電子郵件中已有的純文本標(biāo)記的特性∠扒冢——維基百科
我把與Markdown相關(guān)的基本語(yǔ)法按其類型整理在這里,以便查閱放棒。
標(biāo)題
# 一級(jí)標(biāo)題
## 二級(jí)標(biāo)題
### 三級(jí)標(biāo)題
#### 四級(jí)標(biāo)題
##### 五級(jí)標(biāo)題
###### 六級(jí)標(biāo)題-
列表
- 無(wú)序列表1
- 無(wú)序列表2
- 無(wú)序列表31. 有序列表1 2. 有序列表2 3. 有序列表3
引用
> 這個(gè)是引用
> 是不是和電子郵件中的
> 引用格式很像粗體與斜體
這個(gè)是粗體
這個(gè)是斜體-
鏈接與圖片
自動(dòng)鏈接
http://xhstormr.github.io/
XhstormR@foxmail.com
插入鏈接[link text](http://example.com/ "optional title") [link text][id] [id]: http://example.com/ "optional title here"
插入圖片
需要知道圖片地址!
方式: 把圖片拖到網(wǎng)頁(yè)中! 路徑就會(huì)顯示出來(lái)! 然后復(fù)制到下邊代碼的path上!
簡(jiǎn)書(shū)會(huì)自動(dòng)返回一個(gè)鏈接!!! 如下圖
{ImgCap}FireChat {/ImgCap}
-
代碼 //
用TAB鍵起始的段落姻报,會(huì)被認(rèn)為是代碼塊
<php>
echo “hello world";
</php>
如果在一個(gè)行內(nèi)需要引用代碼,只要用反引號(hào)`引起來(lái)就好Use the `printf()` function.
-
分割線间螟、刪除線
可以在一行中用三個(gè)以上的星號(hào)吴旋、減號(hào)、底線來(lái)建立一個(gè)分隔線,用~可建立刪除線厢破。--- ~~Mistaken text.~~
-
代碼塊與語(yǔ)法高亮
```ruby require 'redcarpet' markdown = Redcarpet.new("Hello World!") puts markdown.to_html ```
段落荣瑟、標(biāo)題、區(qū)塊代碼
區(qū)塊引用則使用 email 形式的 '>' 角括號(hào)摩泪。
加粗 加粗 **加粗**
斜體 斜體 *斜體*
加粗斜體 加粗斜體 ***加粗斜體***
- 表格
# | dfa | fd |
---|---|---|
fdf | fdaf | Fda |
fdf | fdaf | Fda |
Markdown 語(yǔ)法:
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
修辭和強(qiáng)調(diào)
Markdown 使用星號(hào)和底線來(lái)標(biāo)記需要強(qiáng)調(diào)的區(qū)段笆焰。
Markdown 語(yǔ)法:
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__.
列表
無(wú)序列表使用星號(hào)、加號(hào)和減號(hào)來(lái)做為列表的項(xiàng)目標(biāo)記见坑,這些符號(hào)是都可以使用的嚷掠,使用星號(hào):
* Candy.
* Gum.
* Booze.
加號(hào):
+ Candy.
+ Gum.
+ Booze.
和減號(hào)
- Candy.
- Gum.
- Booze.
有序的列表則是使用一般的數(shù)字接著一個(gè)英文句點(diǎn)作為項(xiàng)目標(biāo)記:
1. Red
2. Green
3. Blue
鏈接
[Markdown-Syntax-CN](https://gitcafe.com/riku/Markdown-Syntax-CN/blob/master/syntax.md#p)
圖片
{ImgCap}alt text{/ImgCap}
參考形式:
![][id]{ImgCap}alt text{/ImgCap}
Markdown 支持以下這些符號(hào)前面加上反斜杠來(lái)幫助插入普通的符號(hào):
\ 反斜線
` 反引號(hào)
* 星號(hào)
_ 底線
{} 花括號(hào)
[] 方括號(hào)
() 括弧
# 井字號(hào)
+ 加號(hào)
- 減號(hào)
. 英文句點(diǎn)
! 驚嘆號(hào)