Markdown 初學總結

Markdown Tutorial(Typora-Specific)

1. Headers

最多可有六級標題,在標題前加 # 作爲標記。注意標記與標題內容之間有空格:

# 這是一級標題
## 這是二級標題
### 這是三級標題
#### 這是四級標題
##### 這是五級標題
###### 這是六級標題

顯示如下:

這是一級標題

這是二級標題

這是三級標題

這是四級標題

這是五級標題
這是六級標題

2. 段落與換行

段內換行:

  1. 2空格加回車(Typora不可用),Typora使用 Shift + Enter 可實現換行。

  2. 使用br

    This is<br>
    paragraph one.
    And this is paragraph two.

    顯示如下:

    This is
    paragraph one.

    And this is paragraph two.

段落:段與段間隔一個或多個空行,如下所示

This is Paragraph1

Here is Another

顯示如下

This is Paragraph1

Here is Another

3. 引用(Blockquotes)

在行首使用 \> 標記,下一行不加 \> 也會繼續引用:

> This is a comment
This is another comment

顯示如下:

This is a comment
This is a comment too

多級引用:

> This is a comment
> This is another comment
> Blabla

顯示如下:

This is a comment

This is another comment

Blablabla

4. 列表

無序列表

使用 -+* 作爲標記(等價):

- use '-' as mark
+ or use '+' as mark
* or use '*' as mark

顯示如下:

  • use '-' as mark

  • or use '+' as mark

  • or use '*' as mark

被嵌套的標目標記前加四個spaces或一個tab,可使用嵌套的列表:

+ 1
    + 2
        + 3

顯示如下:

  • 1
    • 2
      • 3

有序列表

使用數字作爲標記:

1. item1
2. item1
    1. item 2.1
    2. item 2.2
  1. item1
  2. item2
    1. item 2.1
    2. item 2.2

Task List

此爲Markdown拓展語法,並不是所有瀏覽軟件都能夠支持。效果爲生成一個可以勾選的列表:

- [ ] Eat
- [x] Code
  - [x] HTML
  - [x] CSS
  - [x] JavaScript
- [ ] Sleep

效果如下(Typora中的截圖):

5. 分割線

使用三個或更多的 *+_ 繪製分割線:

***
+++
___

+++


也可以直接使用HTML標記 <hr>

6. 字體及文字標記

使用 *_ 包圍文字是文字變爲斜體,使用 **__ 包圍文字實現黑體,二者可同時使用。成對使用二者並且需要顯示原內容時,使用轉義 \*\_

*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

_You **can** combine them_

效果如下:

This text will be italic
This will also be italic

This text will be bold
This will also be bold

You can combine them

下劃線、刪除線

Markdown不支持此類標記原生語法,但可以使用由Github等提供的拓展的Markdown或者直接使用HTML提供的語法:

<u>Underlined Text</u>
~~DELETED~~

Underlined Text
DELETED

字體設置

在Markdown內使用HTML tag是可以接受的,通過設置 <font> 來進一步設置字體:

<font size="5" color="red">This is some text!</font>

This is some text!

7. 超鏈接

格式爲 [link text](URL "Optional title") ,可用 '" 。例如:

[MyBlog](https://www.cnblogs.com/wyzersblog/ "ddkk64")
[icon.png](./images/icon.png)

MyBlog

[Google][]
這樣可以使代碼更加整潔
[Google]: http://google.com/

使用 <> 包括的 URL 或郵箱地址會被自動轉換爲超鏈接,會使用 URL 作爲鏈接文字。

<http://example.com/>

http://example.com/

對於e-mail地址,Markdown會做一些隨機編碼處理以防止垃圾郵件機器人收集信息1

<[email protected]>

8. 圖片

內聯型語法

![Alt text](https://pic.cnblogs.com/avatar/1611794/20191201214317.png)
![Alt text](/path/to/img.jpg "Optional title")

icoin

引用型語法

![Alt text][id]
這樣可以使代碼更加整潔
[id]: url/to/image  "Optional title attribute"

icoin
這樣可以使代碼更加整潔

圖片屬性

標準markdown語法沒有提供圖片屬性的修改,但可以使用HTML的 <img> 屬性進行修改。

9. Latex數學公式輸入

Markdown本身並不支持數學公式渲染生成 ,要在Markdown文檔內使用數學公式,有但不限於以下幾種選擇:

  • 支持Latex公式輸入的編輯器,如Typora等。本文就是在Typora中撰寫。
  • 引用外鏈進行渲染,如GitHub上就需要用此方式

博客園Markdown支持Latex數學輸入:

內聯的公式 $\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta$

內聯的公式 \(\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta\)

**(算數-均值不等式)**設$a_1,a_2,...,a_n$爲正數,有
$$
\frac{n}{\sum_{k=1}^{n}\frac{1}{a_k}}  \le  \sqrt[n]{a_1a_2...a_n}  \le  \frac{1}{n}\sum_{k=1}^{n}a_k  \tag{1.1}
$$
當且僅當 $a_1=a_2=..=a_n$ 取等號。

(算數-均值不等式)\(a_1,a_2,...,a_n\)爲正數,有
\[ \frac{n}{\sum_{k=1}^{n}\frac{1}{a_k}} \le \sqrt[n]{a_1a_2...a_n} \le \frac{1}{n}\sum_{k=1}^{n}a_k \tag{1.1} \]
當且僅當 \(a_1=a_2=..=a_n\) 取等號。

10. 表格

表格也屬於拓展語法。

使用 | 來分隔不同的單元格,使用 - 來分隔表頭和其他行:

First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column
First Header Second Header
Content from cell 1 Content from cell 2
Content in the first column Content in the second column1

11. 代碼

//TODO


  1. 我用博客園的Markdown預覽試了下,並沒有發現任何的加密。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章