【发布时间】:2021-06-13 06:38:31
【问题描述】:
有没有一种方法可以将 tmLanguage.json 导入 Sphinx 以添加对 RST 新/自定义语言的支持?
【问题讨论】:
标签: python-sphinx restructuredtext tmlanguage
有没有一种方法可以将 tmLanguage.json 导入 Sphinx 以添加对 RST 新/自定义语言的支持?
【问题讨论】:
标签: python-sphinx restructuredtext tmlanguage
没有直接;如有必要,您必须为 Python 中的新语言编写词法分析器。我说 如果需要 因为 Sphinx 的语法高亮是由 Pygments 提供的,它支持 huge number of languages;你只需要在 Sphinx 中使用 highlight_language 配置值 turn support on。所有各种词法分析器的简称都显示为here。
如果不知何故你的语言还没有词法分析器,有instructions 告诉你如何编写你自己的。这在很大程度上(但不完全)是将.tmLanguage.json文件中的Oniguruma regexes翻译成Python-flavored ones的过程。
也希望您也将contribute it 加入pygments Github 项目。
【讨论】: