程序猿经常用MarkDown来写各种科技文档,岂不知AsciiDoc写能出版的文档要吊打MarkDown几条街.
VS Code作为宇宙第一编辑器,用它来写AsciiDoc也是爽歪歪的.
找来找去市面上没有一款好用的专门准对AsciiDoc的代码片段插件,于是自己动手打造了一个,吐血献给程序猿们!
废话少说,直接上代码
{
// Place your snippets for asciidoc here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Anchor": {
"prefix": "Anchor",
"body": [
"[[${TM_SELECTED_TEXT}$1]]"
],
"description": "锚"
},
"Source": {
"prefix": "source",
"body": [
"[source, ${1:java}]",
"----",
"${TM_SELECTED_TEXT}${0}",
"----"
],
"description": "Source Code"
},
"NOTE": {
"prefix": "note",
"body": [
"[NOTE]\n====\n${TM_SELECTED_TEXT}${1}\n===="
],
"description": "注意"
},
"Tip": {
"prefix": "tip",
"body": [
"[TIP]\n====\n${TM_SELECTED_TEXT}${1}\n===="
],
"description": "提示"
},
"IMPORTANT": {
"prefix": "important",
"body": [
"[IMPORTANT]\n====\n${TM_SELECTED_TEXT}${1}\n===="
],
"description": "重要"
},
"WARNING": {
"prefix": "warning",
"body": [
"[WARNING]\n====\n${TM_SELECTED_TEXT}${1}\n===="
],
"description": "警告"
},
"CAUTION": {
"prefix": "caution",
"body": [
"[CAUTION]\n====\n${TM_SELECTED_TEXT}${1}\n===="
],
"description": "小心"
},
"Bold": {
"prefix": "bold",
"body": [
" *${TM_SELECTED_TEXT}${1}* "
],
"description": "黑体"
},
"Mono": {
"prefix": "mono",
"body": [
" `${TM_SELECTED_TEXT}$1` "
],
"description": "等宽"
},
"Italy": {
"prefix": "italy",
"body": [
" _${TM_SELECTED_TEXT}${1}_ "
],
"description": "斜体"
},
"Yellow": {
"prefix": "yellow",
"body": [
" #${TM_SELECTED_TEXT}${1}# "
],
"description": "黄色背景"
},
"URL": {
"prefix": "url",
"body": [
"${TM_SELECTED_TEXT}[${1},windows=_blank]"
],
"description": "超链接"
},
"Image": {
"prefix": "image",
"body": [
"image::images/${TM_SELECTED_TEXT}${1}[\"\"]"
],
"description": "图像链接"
},
"Big": {
"prefix": "Big",
"body": [
"[.big]#${TM_SELECTED_TEXT}${1}#"
],
"description": "字体加大"
},
"Sidebar": {
"prefix": "sidebar",
"body": [
"[sidebar]\n.Title\n****\n${TM_SELECTED_TEXT}${1}\n****"
],
"description": "Sidebar"
},
"Toc": {
"prefix": "toc",
"body": [
":icons: font",
":toc: left",
":toclevels: 5",
":toc-title: 目录",
":source-highlighter: highlightjs",
":prewrap!:",
":experimental:",
"${1}"
],
"description": "文档属性"
},
"Underline": {
"prefix": "underline",
"body": [
"[.underline]#${TM_SELECTED_TEXT}${1}#"
],
"description": "下划线"
},
"Xref": {
"prefix": "xref",
"body": [
"xref:${TM_SELECTED_TEXT}${1}[${TM_SELECTED_TEXT},window=_blank]"
],
"description": "引用外部文档"
},
"Footnote": {
"prefix": "footnote",
"body": [
"footnote:${TM_SELECTED_TEXT}[${1}]"
],
"description": "脚注"
},
"Table": {
"prefix": "table",
"body": [
"[options=\"header\"]",
"[%autowidth.stretch]",
"|===",
"| HeadA${1} | HeadB",
"//-------------",
"| Row1A | Row1B",
"| Row2A | Row2B",
"| Row3A | Row3B",
"|==="
],
"description": "表格"
},
"Hardbreaks": {
"prefix": "hardbreaks",
"body": [
"[%hardbreaks]",
"${TM_SELECTED_TEXT}${1}"
],
"description": "强制换行"
},
"Keyboard Macro": {
"prefix": "kbd",
"body": [
"kbd:[${1:Ctrl+T}]"
],
"description": "键盘宏"
},
"Cross Reference": {
"prefix": "cross",
"body": [
"<<${TM_SELECTED_TEXT}$1,${TM_SELECTED_TEXT}$2>>"
],
"description": "文档内的交叉引用"
}
}
文件名是: asciidoc.json
, 保存在 ${户文件夹目录}\user-data\User\snippets
目录下就行.