3 分钟阅读
Markdown 语法指南

这篇文章用来快速演示 Markdown 最常见的写法。
如果你只是想把模板跑起来,其实先掌握下面几种语法就够了。


标题

标题使用 # 开头,数量代表层级。

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

段落

普通正文直接写在空行之间即可。

这是第一段。

这是第二段。

这是第一段。

这是第二段。


强调

你可以用加粗和斜体强调重点。

这是 **加粗** 文本
这是 *斜体* 文本
这是 ***同时加粗和斜体***

这是 加粗 文本
这是 斜体 文本
这是 同时加粗和斜体


链接

链接的基本写法如下:

[Astro 官网](https://astro.build)

Astro 官网


列表

无序列表和有序列表都很常用。

- 条目一
- 条目二
  - 子条目

1. 第一步
2. 第二步
3. 第三步
  • 条目一
  • 条目二
    • 子条目
  1. 第一步
  2. 第二步
  3. 第三步

图片

你可以引用当前目录里的图片,也可以引用公共目录图片。

![示例图片](./spongebob.webp)
![公共资源](/patrick.webp)

示例图片


引用

引用适合放一句摘录或备注。

> 这是一个引用块。
> 可以连续写多行。

这是一个引用块。
可以连续写多行。


代码块

如果你要展示命令或配置,可以使用 fenced code block。

```bash
npm install
npm run build

```bash
npm install
npm run build

小结

Markdown 的优势就在于:

  • 写法轻
  • 结构清楚
  • 很适合博客和项目文档

如果你后续还需要更复杂的内容能力,可以继续使用这个模板里的 MDX 示例页面。

E=mc2


Keyboard

Use the <kbd> tag to denote keys on the keyboard.

<kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>Delete</kbd>

CTRL + ALT + Delete


Abbreviate

Use the <abbr> tag to denote abbreviation.

<abbr title="Graphics Interchange Format">GIF</abbr>

GIF


Highlight

Use the <mark> tag to denote highlighted text.

<mark>Very important text</mark>

Very important text


Task Lists

Combine a list with 2 square brackets. spc incomplete x complete.

- [x] Take out trash
- [ ] Mow the lawn
- [ ] Buy more bitcoin
  • Take out trash
  • Mow the lawn
  • Buy more bitcoin

Tables

Use - for header, | for columns, : for alignment.

| Item    | Ct  |
| :------ | --: |
| Bread   | 1   |
| Milk    | 1   |
| Haribo  | 10  |
ItemBuy
Bread1
Milk1
Haribo10

Footnotes

Add a caret and an id inside brackets [^1] to create a footnote.

Here's a simple footnote, [^1] and here's a another one. [^2]
[^1]: This is the first footnote.
[^2]: This is the second footnote.

Here’s a simple footnote, 1 and here’s a another one. 2

See the bottom of the page to view the footnotes.


Code

Use backticks ` to denote a word or phrase as code.

`package.json`

package.json


Code Blocks

Denote a code block by enclosing a section of valid code in triple backticks. Syntax highlight the code by using the shorthand symbol for the language. Ex: js, javascript, python

```js
  function hello() {
    console.log("hello world");
  }
```
  function hello() {
    console.log("hello world");
  }

Conclusion

Please refer to markdownguide.org for best practices as well as advanced and extended syntax.

https://www.markdownguide.org/basic-syntax https://www.markdownguide.org/extended-syntax/


Footnotes

  1. This is the first footnote.

  2. This is the second footnote.