如何将自定义 tmLanguage 语法添加到 Sphinx/RST
How to add a custom tmLanguage syntax to Sphinx/RST
是否有方法可以将 tmLanguage.json
导入 Sphinx 以添加对 new/custom RST 语言的支持?
直接没有;如有必要,您必须在 Python 中为一种新语言编写词法分析器。我说 如有必要 因为 Sphinx 的语法高亮是由 Pygments, which supports a huge number of languages; you just need to turn support on in Sphinx using the highlight_language
config value. The short names for all the various lexers are shown here.
在幕后提供的
如果不知何故,您的语言还没有词法分析器,那么 instructions on how to write your own. It's largely (but not entirely) a process of translating the Oniguruma regexes in the .tmLanguage.json
file to Python-flavored ones。
也希望您 contribute it 也加入 pygments
Github 项目。
是否有方法可以将 tmLanguage.json
导入 Sphinx 以添加对 new/custom RST 语言的支持?
直接没有;如有必要,您必须在 Python 中为一种新语言编写词法分析器。我说 如有必要 因为 Sphinx 的语法高亮是由 Pygments, which supports a huge number of languages; you just need to turn support on in Sphinx using the highlight_language
config value. The short names for all the various lexers are shown here.
如果不知何故,您的语言还没有词法分析器,那么 instructions on how to write your own. It's largely (but not entirely) a process of translating the Oniguruma regexes in the .tmLanguage.json
file to Python-flavored ones。
也希望您 contribute it 也加入 pygments
Github 项目。