Markdown 样式指南

Markdown 样式指南

Markdown 样式指南

2025-12-05
766 字 · 6 分钟

以下是一个在 Astro 中编写 Markdown 内容时可以使用的部分基本 Markdown 语法示例。

1.标题

以下HTML中的 <h1><h6> 元素表示六个级别的章节标题。<h1> 是最高级别,而 <h6> 是最低级别。

H1

H2

H3

H4

H5
H6

2.段落

Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.

Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.

3.图片

语法

MARKDOWN
![Alt text](https://zayck-img.pages.dev/file/来自新世界/1764985164363_BandiView_background-light.webp)

输出

Alt text

4.块引用

块引用元素表示从另一来源引用的内容,可附带引用信息(该信息必须位于脚注或引用元素内),并可能包含一些内嵌改动,如注释和缩写。

4.1 无署名的引用

语法

MARKDOWN
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
> **Note** that you can use _Markdown syntax_ within a blockquote.

输出

Tiam, ad mint andaepu dandae nostion secatur sequo quae. Note that you can use Markdown syntax within a blockquote.

4.2 有署名的引用

语法

MARKDOWN
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>

输出

Don’t communicate by sharing memory, share memory by communicating.
Rob Pike1

4.3 表格

语法

MARKDOWN
| Italics   | Bold     | Code   |
| --------- | -------- | ------ |
| _italics_ | **bold** | `code` |

输出

ItalicsBoldCode
italicsboldcode

4.4 代码块

语法

we can use 3 backticks ``` in new line and write snippet and close with 3 backticks on new line and to highlight language specific syntac, write one word of language name after first 3 backticks, for eg. html, javascript, css, markdown, typescript, txt, bash

MARKDOWN
```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k, a[N];
long long ans;
vector<int> v[N];
int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        v[i % k].push_back(a[i]);
    }
    for (int i = 0; i < k; i++)
        sort(v[i].rbegin(), v[i].rend());
    for (int i = 0; i < k; i++)
    {
        for (int j = 0; j + 1 < v[i].size(); j += 2)
        {
            ans += v[i][j] + v[i][j + 1];
        }
    }
    printf("%lld\n", ans);
    return 0;
}
```

输出

CPP
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k, a[N];
long long ans;
vector<int> v[N];
int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        v[i % k].push_back(a[i]);
    }
    for (int i = 0; i < k; i++)
        sort(v[i].rbegin(), v[i].rend());
    for (int i = 0; i < k; i++)
    {
        for (int j = 0; j + 1 < v[i].size(); j += 2)
        {
            ans += v[i][j] + v[i][j + 1];
        }
    }
    printf("%lld\n", ans);
    return 0;
}

4.5 有序列表

语法

MARKDOWN
1. First item
2. Second item
3. Third item

输出

  1. First item
  2. Second item
  3. Third item

4.6 无序列表

语法

MARKDOWN
- List item
- Another item
- And another item

输出

  • List item
  • Another item
  • And another item

4.7 嵌套列表

语法

MARKDOWN
- Fruit
  - Apple
  - Orange
  - Banana
- Dairy
  - Milk
  - Cheese

输出

  • Fruit
    • Apple
    • Orange
    • Banana
  • Dairy
    • Milk
    • Cheese

4.8 其他

语法

MARKDOWN
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.

H<sub>2</sub>O

X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>

Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.

Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.

输出

GIF is a bitmap image format.

H2O

Xn + Yn = Zn

Press CTRL+ALT+Delete to end the session.

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.

Footnotes

  1. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015.


Thanks for reading!

Markdown 样式指南

2025-12-05
766 字 · 6 分钟
已复制链接

Comments