【发布时间】:2021-04-01 10:09:51
【问题描述】:
我在我的项目中使用 RTD + Sphinx (redgrease = https://github.com/lyngon/redgrease),似乎代码块的语法突出显示在 readthedocs.io 页面上不起作用。
它只在一个框中显示黑色文本。
例如见清单项目 3: https://redgrease.readthedocs.io/en/latest/intro.html#intro-redgrease
当我在本地构建(使用 sphinx-build)以及在 VS Code 中使用 reStructuredText 插件构建时,语法突出显示效果很好。
工作(本地)
不工作(readthedocs.io)
代码块都是缩进的(因为它们出现在列表中),类似于:
#. :ref:`Server-side Redis commands <red_commands>`.
Allowing for ... blah blah ...
It is ... yada yada ...
.. code-block:: python
:emphasize-lines: 8, 11, 13
import redgrease
import redgrease.utils
# ... moar codes ..
可能会发生什么? 我需要一些扩展或添加一些配置选项吗? 我在 'conf.py' 和 '.readthedocs.yml' 中没有太多的诡计。 (见回购)
【问题讨论】:
-
RTD 支持能够非常迅速地发现问题。谢谢桑托斯!我已经回复了下面的解决方案。
标签: python syntax-highlighting python-sphinx read-the-docs