markdown-syntax-fundamentals

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Markdown Syntax Fundamentals

Markdown语法基础

Core markdown syntax for creating well-structured documents.
用于创建结构清晰文档的核心Markdown语法。

Headings

标题

markdown
undefined
markdown
undefined

Heading 1

Heading 1

Heading 2

Heading 2

Heading 3

Heading 3

Heading 4

Heading 4

Heading 5
Heading 5
Heading 6
Heading 6
undefined
undefined

Heading Best Practices

标题使用最佳实践

  • Use a single H1 (
    #
    ) per document as the title
  • Don't skip heading levels (H2 to H4)
  • Keep headings concise and descriptive
  • Use sentence case or title case consistently
  • 每个文档仅使用一个H1(
    #
    )作为标题
  • 不要跳过标题层级(如从H2直接跳到H4)
  • 标题应简洁且具有描述性
  • 保持一致的句首大写或标题大小写格式

Text Formatting

文本格式

Emphasis

强调

markdown
*italic* or _italic_
**bold** or __bold__
***bold italic*** or ___bold italic___
~~strikethrough~~
markdown
*italic* or _italic_
**bold** or __bold__
***bold italic*** or ___bold italic___
~~strikethrough~~

Inline Code

行内代码

markdown
Use `backticks` for inline code like `const x = 1`
markdown
Use `backticks` for inline code like `const x = 1`

Lists

列表

Unordered Lists

无序列表

markdown
- Item one
- Item two
  - Nested item
  - Another nested item
- Item three

* Alternative marker
+ Also works
markdown
- Item one
- Item two
  - Nested item
  - Another nested item
- Item three

* Alternative marker
+ Also works

Ordered Lists

有序列表

markdown
1. First item
2. Second item
   1. Nested numbered
   2. Another nested
3. Third item
markdown
1. First item
2. Second item
   1. Nested numbered
   2. Another nested
3. Third item

Task Lists (GitHub Flavored)

任务列表(GitHub风格)

markdown
- [x] Completed task
- [ ] Incomplete task
- [ ] Another task
markdown
- [x] Completed task
- [ ] Incomplete task
- [ ] Another task

Links

链接

Basic Links

基础链接

markdown
[Link text](https://example.com)
[Link with title](https://example.com "Title text")
markdown
[Link text](https://example.com)
[Link with title](https://example.com "Title text")

Reference Links

参考式链接

markdown
[Link text][reference-id]

[reference-id]: https://example.com "Optional title"
markdown
[Link text][reference-id]

[reference-id]: https://example.com "Optional title"

Automatic Links

自动链接

markdown
<https://example.com>
<email@example.com>
markdown
<https://example.com>
<email@example.com>

Internal Links (Anchors)

内部链接(锚点)

markdown
[Jump to section](#section-heading)
Anchor IDs are auto-generated from headings:
  • Lowercase
  • Spaces become hyphens
  • Special characters removed
markdown
[Jump to section](#section-heading)
锚点ID由标题自动生成:
  • 转为小写
  • 空格替换为连字符
  • 移除特殊字符

Images

图片

Basic Images

基础图片

markdown
![Alt text](image.png)
![Alt text](image.png "Optional title")
markdown
![Alt text](image.png)
![Alt text](image.png "Optional title")

Reference Images

参考式图片

markdown
![Alt text][image-id]

[image-id]: path/to/image.png "Optional title"
markdown
![Alt text][image-id]

[image-id]: path/to/image.png "Optional title"

Linked Images

带链接的图片

markdown
[![Alt text](image.png)](https://example.com)
markdown
[![Alt text](image.png)](https://example.com)

Code Blocks

代码块

Fenced Code Blocks

围栏式代码块

markdown
```javascript
function hello() {
  console.log("Hello, World!");
}
```
markdown
```javascript
function hello() {
  console.log("Hello, World!");
}
```

Common Language Identifiers

常用语言标识符

  • javascript
    /
    js
  • typescript
    /
    ts
  • python
    /
    py
  • bash
    /
    shell
    /
    sh
  • json
    /
    yaml
  • html
    /
    css
  • sql
  • markdown
    /
    md
  • javascript
    /
    js
  • typescript
    /
    ts
  • python
    /
    py
  • bash
    /
    shell
    /
    sh
  • json
    /
    yaml
  • html
    /
    css
  • sql
  • markdown
    /
    md

Indented Code Blocks

缩进式代码块

markdown
    // Four spaces or one tab
    function example() {
      return true;
    }
markdown
    // Four spaces or one tab
    function example() {
      return true;
    }

Blockquotes

块引用

Basic Blockquotes

基础块引用

markdown
> This is a blockquote.
> It can span multiple lines.

> Blockquotes can contain
>
> Multiple paragraphs.
markdown
> This is a blockquote.
> It can span multiple lines.

> Blockquotes can contain
>
> Multiple paragraphs.

Nested Blockquotes

嵌套块引用

markdown
> Outer quote
>> Nested quote
>>> Deeply nested
markdown
> Outer quote
>> Nested quote
>>> Deeply nested

Blockquotes with Other Elements

包含其他元素的块引用

markdown
> ## Heading in blockquote
>
> - List item
> - Another item
>
> ```code block```
markdown
> ## Heading in blockquote
>
> - List item
> - Another item
>
> ```code block```

Horizontal Rules

水平线

markdown
---
***
___
Use three or more hyphens, asterisks, or underscores.
markdown
---
***
___
使用三个或更多连字符、星号或下划线。

Escaping Characters

转义字符

markdown
\* Not italic \*
\# Not a heading
\[Not a link\]
\`Not code\`
Characters that can be escaped:
\
`
*
_
{
}
[
]
(
)
#
+
-
.
!
|
markdown
\* Not italic \*
\# Not a heading
\[Not a link\]
\`Not code\`
可转义的字符:
\
`
*
_
{
}
[
]
(
)
#
+
-
.
!
|

Line Breaks

换行

markdown
Line one with two trailing spaces
Line two (hard break)

Line one

Line two (paragraph break)
markdown
Line one with two trailing spaces
Line two (hard break)

Line one

Line two (paragraph break)

Best Practices

最佳实践

  1. Consistent formatting: Pick a style and stick to it
  2. Blank lines: Add blank lines before and after:
    • Headings
    • Code blocks
    • Lists
    • Blockquotes
  3. Line length: Consider wrapping at 80-120 characters for readability
  4. Alt text: Always provide meaningful alt text for images
  5. Link text: Use descriptive link text, not "click here"
  6. Code highlighting: Always specify language for fenced code blocks
  1. 格式一致性:选择一种风格并保持统一
  2. 空白行:在以下元素前后添加空白行:
    • 标题
    • 代码块
    • 列表
    • 块引用
  3. 行长度:考虑将行宽限制在80-120字符以提升可读性
  4. 替代文本:始终为图片提供有意义的替代文本
  5. 链接文本:使用描述性链接文本,而非“点击此处”
  6. 代码高亮:围栏式代码块始终指定语言