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

本文介绍了AsciiDoc,一种轻量级的文档格式,以及如何利用VSCode创建一个专门针对AsciiDoc的代码片段插件,以提高程序员编写科技文档的体验。文中提到了与Markdown的比较以及提供的各种文本格式化快捷方式和片段示例。
摘要由CSDN通过智能技术生成

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 目录下就行.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱游泳的老白

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值