markdown语法

markdown语法

fetch150zy

markdown基础语法

Basic Syntax

Headings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Markdown: # 1 ~ 6 headings level (recommend)
# heading level 1
## heading level 2
### heading level 3
#### heading level 4
##### heading level 5
###### heading level 6
// markdown has another way to headings (not recommend)
Heading level 1
===============
Heading level 2
---------------

HTML:<h1> </h1>
<h1> heading level 1 </h1>
<h2> heading level 2 </h2>
<h3> heading level 3 </h3>
<h4> heading level 4 </h4>
<h5> heading level 5 </h5>
<h6> heading level 6 </h6>

Hot key:
ctrl 1~6 // 1 ~ 6 headings level
ctrl 0 // recover
ctrl = // increase heading level
ctrl - // decrease heading level

// heading id (Usually the editor will automatically set the custom-id to the title itself)
// exp: ### title name {#title name}
### My Great Heading {#custom-id}
<h3 id="custom-id">My Great Heading</h3>

// linking to heading id
[Heading IDs](#heading-ids)
<a href="#heading-ids">Heading IDs</a>

Paragraph

1
2
3
4
5
6
7
8
9
10
Markdown: using space line
markdown is very nice. // first paragraph
// using a blank line to separate different paragraphs
html is also nice. // second paragraph

HTML:<p> </p>
<p> markdown is very nice.</p> // fisrt paragraph
<p> and html is also nice</p> // second paragraph

Unless the paragraph is in a list, don’t indent paragraphs with spaces or tabs.

Line break

1
2
3
4
5
6
7
Markdown: write a line and end with two or more spaces
First line with two spaces after. // here has two spaces
And the next line.

HTML:<br> // it's hard to see trailing whitespace in an editor
<p>First line with two spaces after.<br>
And the next line.</p>

Font

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**bold part**					// Bold
__bold part__ // (not recommend)
<strong>bold part</strong> // HTML

*italic part* // Italic
_italic part_ // (not recommend)
<em>italic part</em> // HTML

***bold and italic part*** // Bold and Italic (recommend)
**_bold and italic part_**
___bold and italic part___
*__bold and italic part__* // (not recommend)
<strong><em>info</em></strong>
<em><strong>info</strong></em> // HTML

==highlight part== // highlight
<mark>highlight part</mark>

~~delete part~~ // strikethrough

<ins>underlined</ins> // underlined

Block quotes

1
2
3
4
5
6
7
8
9
10
Markdown:
> reference level 1
>> reference level 2
>>> reference level 3

For compatibility, put blank lines before and after blockquotes.
exp:
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Horizontal rule

1
2
3
4
5
6
7
8
9
10
---									// (recommend)
___
***

exp:
Try to put a blank line before...

---

...and after a horizontal rule.

image

1
2
3
4
5
6
7
8
9
// online or local image
Markdown:
![image alt](image path or link address "image title")

HTML:
<img src="image path or link address" alt="image alt" title="image title">

// link image
[![image alt](image path or link address "image title")](link address "hyperlink name")

List

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ordered list
Markdown:
1. First item // (recommend)
2. Second item
3. Third item
4. Fourth item

1) First item // (not recommend)

HTML:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
<li>Fourth item</li>
</ol>

// unordered list
- First item // (recommend)
- Second item
- Third item
- Fourth item

+ First item // (not recommend)
* Second item // (not recommend)

HTML:
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
<li>Fourth item</li>
</ul>

// Hot key
tab // downgrade
shift + tab // upgrade
ctrl + shift + [ // ordered list
ctrl + shift + ] // unordered list
1
2
3
4
5
6
7
8
[label name](url)								// ctrl + click
[label name](url "info of this label") // appear as a tooltip when the user hovers over the link
<a href="url" title="name"> display name</a> // HTML

<url>
<mail address> // convert url or mail to link

`http://example.com` // disable url by using inline code
1
2
3
4
5
6
7
8
[text] [num]
[num]: <url> "info"

// using %20 replace space
[link](https://www.example.com/my%20great%20page)
<a href="https://www.example.com/my great page">link</a> // (recommend)

[link](https://www.example.com/my great page) // (not recommend)

Extended Syntax

Tables

1
2
3
4
5
6
7
8
9
10
11
12
| Syntax      | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |

// You can align text in the columns to the left, right, or center by adding a colon (:) to the left, right, or on both side of the hyphens within the header row

// left center right
| Syntax | Description | Test Text |
| :--- | :----: | ---: |
| Header | Title | Here's this |
| Paragraph | Text | And more |

Code block

1
2
3
4
5
6
7
8
9
// Fenced Code Blocks
```
// Syntax Highlighting
```shell

// inline code
`code` // inline code
``..`code`..`` // using ` ` to strengthen your code in inline code
<code>code</code> // HTML

Footnote

1
2
3
4
5
6
7
8
9
10
11
Here's a simple footnote,[^1] and here's a longer one.[^bignote]

[^1]: This is the first footnote.

[^bignote]: Here's one with multiple paragraphs and code.

Indent paragraphs to include them in the footnote.

`{ my code }`

Add as many paragraphs as you like.

Define list

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Markdown:
First Term
: This is the definition of the first term.

Second Term
: This is one definition of the second term.
: This is another definition of the second term.

HTML:
<dl>
<dt>First Term</dt>
<dd>This is the definition of the first term.</dd>
<dt>Second Term</dt>
<dd>This is one definition of the second term. </dd>
<dd>This is another definition of the second term.</dd>
</dl>

Subscript&Superscript

1
2
H~2~O						// Subscript
X^2^ // Superscript

Task list

1
2
- [x] checked
- [ ] unchecked

Hacker

Indent (Tab)

1
&nbsp;&nbsp;&nbsp;&nbsp;This is the first sentence of my indented paragraph.

Text Center

1
2
3
<center>This text is centered.</center>						// (deprecated)

<p style="text-align:center">Center this text</p> // (recommend)

Text Color

1
2
3
<font color="red">This text is red!</font>					// (deprecated)

<p style="color:blue">Make this text blue.</p> // (recommend)

Comments

1
2
3
4
5
Here's a paragraph that will be visible.
[This is a comment that will be hidden.]: #
And here's another paragraph that's visible.

<!--comments-->

Symbols

1
2
3
4
5
6
7
8
9
10
Copyright (©) — &copy;
Registered trademark (®) — &reg;
Trademark (™) — &trade;
Euro (€) — &euro;
Left arrow (←) — &larr;
Up arrow (↑) — &uarr;
Right arrow (→) — &rarr;
Down arrow (↓) — &darr;
Degree (°) — &#176;
Pi (π) — &#960;

Table of Contents

1
2
3
4
5
6
#### Table of Contents

- [Underline](#underline)
- [Indent](#indent)
- [Center](#center)
- [Color](#color)