【发布时间】:2020-11-17 14:49:55
【问题描述】:
在重组文本中,标题使用相同数量的非字母数字 7 位 ASCII 字符作为标题文本。如果同时使用下划线和上划线,则应相等且至少与标题文本一样长。来自official docs:
标题带有下划线(或过度 和下划线)与印刷 非字母数字 7 位 ASCII 特点。推荐选择 是“
= - ` : ' " ~ ^ _ * + # < >”。 下划线/上划线必须位于 至少和标题文本一样长。
标题
示例=========================================================
Main titles are written using equals signs over and under
=========================================================
我想为此创建一个 VS Code sn-p。我能做的也只有这个了,
"Title RST": {
"prefix": "title",
"body": [
"="
"$1"
"=\n"
"$0"
],
"description": "Title for restructured text"
}
有没有办法知道将要输入的文本的长度,并相应地插入相同数量的上划线和下划线=。
在yasnippet in emacs,他们这样做:
${1:$(make-string (string-width yas-text) ?\=)}
${1:Title}
${1:$(make-string (string-width yas-text) ?\=)}
$0
任何帮助如何在VS代码中实现这样的sn-p?我在 VS Code here 的 restructured text 扩展中查看了 sn-ps,但找不到适合我的需求。
【问题讨论】:
标签: visual-studio-code emacs restructuredtext vscode-snippets yasnippet