GFM Alerts記法のスニペットを設定する

/
#vscode#markdown

GitHub で > [!NOTE] といったアラート記法を使えるようになったので、VSCode でスニペットを設定しました。

アラートについて

New Markdown extension: Alerts provide distinctive styling for significant content - The GitHub Blog

Note

Useful information that users should know, even when skimming content.

Tip

Helpful advice for doing things better or more easily.

Important

Key information users need to know to achieve their goal.

Warning

Urgent info that needs immediate user attention to avoid problems.

Caution

Advises about risks or negative outcomes of certain actions.

undefined
1
> [!NOTE]
2
> Useful information that users should know, even when skimming content.
3
4
> [!TIP]
5
> Helpful advice for doing things better or more easily.
6
7
> [!IMPORTANT]
8
> Key information users need to know to achieve their goal.
9
10
> [!WARNING]
11
> Urgent info that needs immediate user attention to avoid problems.
12
13
> [!CAUTION]
14
> Advises about risks or negative outcomes of certain actions.

スニペット

/snippets/markdown.json
1
{
2
"GFM Alerts NOTE": {
3
"prefix": [
4
"alerts",
5
"note"
6
],
7
"body": [
8
"> [!NOTE]",
9
"> $0"
10
],
11
"description": "Useful information that users should know, even when skimming content."
12
},
13
"GFM Alerts Tip": {
14
"prefix": [
15
"alerts",
16
"tip"
17
],
18
"body": [
19
"> [!TIP]",
20
"> $0"
21
],
22
"description": "Helpful advice for doing things better or more easily."
23
},
24
"GFM Alerts IMPORTANT": {
25
"prefix": [
26
"alerts",
27
"important"
28
],
29
"body": [
30
"> [!IMPORTANT]",
31
"> $0"
32
],
33
"description": "Key information users need to know to achieve their goal."
34
},
35
"GFM Alerts WARNING": {
36
"prefix": [
37
"alerts",
38
"warning"
39
],
40
"body": [
41
"> [!WARNING]",
42
"> $0"
43
],
44
"description": "Urgent info that needs immediate user attention to avoid problems."
45
},
46
"GFM Alerts CAUTION": {
47
"prefix": [
48
"alerts",
49
"caution"
50
],
51
"body": [
52
"> [!CAUTION]",
53
"> $0"
54
],
55
"description": "Advises about risks or negative outcomes of certain actions."
56
}
57
}

remark plugin

markdown を処理する際の remark plugin として、remark-github-alerts を利用した。

hyoban/remark-github-alerts: Support GitHub-style alerts for remark