簡介
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
- Red
- Green
- 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.
圖片
如:


生成:
水平分隔線
---
生成:
代碼高亮
==highlight==
生成:
==highlight==
本文只是介紹了一些小編常用的語法,Markdown還用很多高級語法,比如數學表達式,流程圖,Emoji等等,這里就不一一細說了,有興趣的童鞋可以自己查閱一下~