The Complete Guide to Markdown Syntax

Introduction

Markdown is a lightweight markup language designed to simplify the formatting of text. Its syntax is simple, easy to learn, and can be applied to various text editing and blogging platforms. The following are some commonly used Markdown syntax examples.

1. Title

Markdown supports multi-level headings, using the # symbol followed by spaces to represent different levels of headings.

# 一级标题
## 二级标题
### 三级标题

2. Paragraphs and line breaks

Use blank lines to separate paragraphs. If you want to wrap the line, you can insert <br> to wrap the line.

这是第一个段落。

这是第二个段落。

这是一行文本。<br>这是另一行文本。

This is the first paragraph.

This is the second paragraph.

This is a line of text.
This is another line of text.

3. Text style

Bold and italics

Surround text with ** or __ to make it bold, and * or _ with text to make it italic.

**粗体** 和 *斜体*
__粗体__ 和 _斜体_

bold and italic
bold and italic

Strikethrough and code

Surround text with ~~ to strikethrough, and ` to indicate code.

~~删除线~~ 和 `代码`

strikethrough and代码

Nested tags

Some tags can be nested within other tags.

**这是粗体,_包含斜体_,再回到粗体。**

This is bold, including italics , and back to bold.

4. Link

inline link

Create an inline link using the format [link text](link address).

这是一个[链接示例](https://www.example.com)。

Here is a link example .

Reference link

Define the link at the end of the article and cite it in the text.

这是一个[引用链接示例][1]。

[1]: https://www.example.com

This is an example of a citation link .

5. List

unordered list

Use *, + or - to create an unordered list.

+ 项目1
- 项目2
  - 子项目
* 项目3
  • Project 1
  • Project 2
    • Subproject
  • Project 3

ordered list

Use numbers plus dots to create ordered lists.

1. 项目1
1. 项目2
1. 项目3
  1. Project 1
  2. Project 2
  3. Project 3

Nested lists

Other lists can be nested within list items.

1. 主要项目
   - 子项目1
   - 子项目2
2. 另一个主要项目
  1. main project
    • Subproject 1
    • Subproject 2
  2. another major project

task list

Use - [ ] to indicate unfinished tasks and - [x] to indicate completed tasks.

- [ ] 任务1
- [x] 任务2
  • Task 1
  • Task 2

6. Quotation block

Use > to create a quote block.

> 这是一个引用块示例。
> 引用可以跨越多行。

Here is an example of a quote block.
Quotes can span multiple lines.

7. Insert pictures

Use ![(image description)(image link)] to insert an image.

![图片描述](图片链接)

8. Horizontal line

Use three or more -, *, or _ to create a horizontal line.

---

9. Code blocks

Use backticks (`) to create inline code, and use three backticks (```) to create code blocks. You can specify the language of the code block.

内联代码:`print("Hello, Markdown!")`

Inline code:print("Hello, Markdown!")

Code block
```python
def hello_world():
print("Hello, world!")
```

def hello_world():
print("Hello, world!")

10. Form

Use | and - to create tables.

| 列1标题 | 列2标题 |
|-------|-------|
| 内容1  | 内容2  |
| 内容3  | 内容4  |
Column 1 header Column 2 header
Content 1 Content 2
Content 3 Content 4

11. Footnotes

Use the [^ mark] to create footnotes within text and define footnote content elsewhere in the document.

这是一个注脚[^1]的示例。

[^1]: 这是注脚的解释。

Here is an example of footnote 1 .

12. Escape characters

Use backslash \ to escape special characters.

这是一个\*星号*而不是斜体。

This is an *asterisk* not italics.

13. Comments

Use <!--Comment content--> to add comments.

<!-- 这是一个注释,不会在渲染后显示 -->

14. Custom title ID

Assign a custom ID to the title to create internal links.

## 我是标题 {#custom-id}

15. LaTeX mathematical formulas

Use $ or $$ to wrap LaTeX math formulas.

这是一个行内公式:$E=mc^2$
这是一个独立公式:
$$
\sum_{i=1}^{n} x_i
$$

This is an inline formula: E = mc 2 E=mc^2E=mc2This
is an independent formula:
∑ i = 1 nxi \sum_{i=1}^{n} x_ii=1nxi

16. Document outline and jump

Use Markdown extended syntax to generate document outlines and internal jumps.

## 目录

- [章节1](#section-1)
- [章节2](#section-2)

## 章节1 {#section-1}

## 章节2 {#section-2}

related resources

Online Markdown editor
Markdown official documentation


  1. This is the explanation of the footnote. ↩︎

Guess you like

Origin blog.csdn.net/weixin_53902288/article/details/132557900