Markdown簡明語法

簡介

markdown是一款比HTML更輕量更容易編寫的標記語言,主要用于排版文章,用最簡單的方式格式化文章,不需要更多繁瑣的操作即可達到美化文章的目的,讓作者專心于寫作!

眾多博客系統,社區都是采用的Markdown格式撰寫,比如大家熟知的Github,簡書。

根據使用的工具或平臺的不一致,效果可能會有所差異,支持程度也不盡相同,本文使用Typora編輯,建議大家使用此編輯器進行查看。


標題

標題使用1~6個#表示,分別對應<h1>~<h6>
如
# This is an H1
## This is an H2
### This is an H3
#### This is an H4
##### This is an H5
###### This is an H6

生成:

This is an H1

This is an H2

This is an H3

This is an H4

This is an H5
This is an H6

引用

引用使用>表示
如
> This is a blockquote with two paragraphs. This is first paragraph.
>
> This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
> This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.

生成:

This is a blockquote with two paragraphs. This is first paragraph.

This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.


列表

列表使用\*或\-開始,表示無序列表,使用數字開頭表示有序列表
如
## un-ordered list
*   Red
*   Green
*   Blue

## ordered list
1.  Red
2.  Green
3.  Blue

生成:

un-ordered list

  • Red
  • Green
  • Blue

ordered list

  1. Red
  2. Green
  3. Blue

任務列表

任務列表使用一對方括號表示[]
如
- [ ] a task list item
- [ ] list syntax required
- [ ] normal **formatting**, @mentions, #1234 refs
- [ ] incomplete
- [x] completed

生成:

  • [ ] a task list item
  • [ ] list syntax required
  • [ ] normal formatting, @mentions, #1234 refs
  • [ ] incomplete
  • [x] completed

代碼塊

行內代碼塊使用一對反引號表示\`,代碼塊使用三個反引號\`\`\`加上對應的語言使用
如
inline-block-code:
`code`

block-code:
?```javascript
function test() {
  console.log("notice the blank line before this function?");
}
?```

?```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
?```

生成:

inline-block-code:
code

block-code:

function test() {
  console.log("notice the blank line before this function?");
}
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

表格

不多說,自己領悟
如
| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |

| Left-Aligned  | Center Aligned  | Right Aligned |
| :------------ |:---------------:| -----:|
| col 3 is      | some wordy text | $1600 |
| col 2 is      | centered        |   $12 |
| zebra stripes | are neat        |    $1 |

生成:

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell
Left-Aligned Center Aligned Right Aligned
col 3 is some wordy text $1600
col 2 is centered $12
zebra stripes are neat $1

粗體、斜體

使用\*或\_包裹的文字
如
*single asterisks*
_single underscores_

生成:

single asterisks
single underscores


鏈接

如
This is [an example](http://example.com/ "Title") inline link.
[This link](http://example.net/) has no title attribute.

生成:

This is an example inline link.

This link has no title attribute.


圖片

如:
![](/path/to/img.jpg)
![Alt text](http://upload-images.jianshu.io/upload_images/2617247-3839830c44afdbb5.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

生成:


水平分隔線

---

生成:



代碼高亮

==highlight==

生成:

==highlight==


本文只是介紹了一些小編常用的語法,Markdown還用很多高級語法,比如數學表達式,流程圖,Emoji等等,這里就不一一細說了,有興趣的童鞋可以自己查閱一下~

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • Markdown是一種輕量級的標記語言,語法簡單,可以排出簡潔的表現界面。 支持表格、代碼塊、LaTeX數學公式、...
    銀之閱讀 11,673評論 0 11
  • 標題 在 Markdown 中,如果一段文字被定義為標題,只要在這段文字前加 # 號即可。#一級標題##二級標題#...
    蘇星河閱讀 558評論 0 7
  • 1. 標題 支持H1~H6 這是H1 這是H2 這是H3 這是H4 這是H5 這是H6 2. 引用 引用 引用可以...
    mixj93閱讀 269評論 0 1
  • 人類的醫療水平在千百年來發展迅速,常規上認為這為人類的發展做出了巨大的無與倫比的貢獻,但是你應該也看到了,醫療的發...
    簡單點就好閱讀 592評論 0 0
  • 其實問出這樣問題的就是表明了態度,那肯定是要去爭鋒了。 這是最好的時代也是最壞的時代——雙城記。 一,這是我們...
    天涯亂閱讀 241評論 0 1