自己亲手打造的VS Code里写AsciiDoc的快捷模板Snippet文件

AsciiDoc简介

  • AsciiDoc是一种文本文档格式(轻量级的标记语言),用于编写注释、文档、文章、书籍、电子书、幻灯片、网页、手册页和博客。
  • AsciiDoc文件可以翻译成多种格式,包括 HTML、PDF、EPUB、手册页面等。ddd
  • AsciiDoc是高度可配置的,用户可以定制和扩展 AsciiDoc 源文件语法和后端输出标记(几乎可以是任何类型的 SGML/XML 标记)。
  • AsciiDoc是免费软件,并根据 GNU 通用公共许可证版本 2(GPLV2)的条款进行许可。

程序猿经常用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 目录下就行.

你可能感兴趣的:(vscode,插件,snippet)