效果如下:

1
2
3
4
![图片描述](图片地址)
<div align="center">
<img src="./图片名.png" alt="说明文字" width="65%">
</div>

1、打开VS快捷键 JSON

Ctrl+Shift+P → 执行:Preferences: Open Keyboard Shortcuts (JSON)

把下面整段粘贴进数组[ ... ]里面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    {
"key": "alt+i",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == markdown",
"args": {
"snippet": "![${1:图片描述}](${2:图片地址})$0"
}
},
{
"key": "alt+t",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == markdown",
"args": {
"snippet": "<div align=\"center\">\n<img src=\"./${1:图片名.png}\" alt=\"${2:说明文字}\" width=\"65%\">\n</div>\n$0"
}
},
//行内代码 `xxx`
{
"key": "alt+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == markdown",
"args": {
"snippet": "`${1:代码片段}`$0"
}
},
//整块代码块 ```lang ... ```
{
"key": "alt+k",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == markdown",
"args": {
"snippet": "```${1:yaml}\n$2\n```\n$0"
}
},
// 下划线插入 <ins>
{
"key": "alt+s",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == markdown",
"args": {
"snippet": "<ins>${1:下划线文字}</ins>$0"
}
},
// markdown下屏蔽原生Ctrl+Enter(插入下方空行)
{
"key": "ctrl+enter",
"command": "-editor.action.insertLineAfter",
"when": "editorTextFocus && editorLangId == markdown"
},
// markdown下:Ctrl+Enter → 输出<br>硬换行
{
"key": "ctrl+enter",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == markdown",
"args": {
"snippet": "<br>\n"
}
}
]


Alt+I 普通图片

Alt+T 居中图片 HTML 块

Alt+c 行内代码 \xxx\ `

Alt+k 代码块

Alt+S 下划线 文字
Ctrl+Enter硬换行