sphinx 代码块 readthedocs.io 上的语法高亮显示
Syntax highlighting on readthedocs.io of sphinx code-block
我在我的项目中使用 RTD + Sphinx (redgrease = https://github.com/lyngon/redgrease),代码块的语法突出显示似乎在 readthedocs.io 页面上不起作用。
它只在框中显示黑色文本。
例如见列表项目 3:
https://redgrease.readthedocs.io/en/latest/intro.html#intro-redgrease
当我在本地构建(使用 sphinx-build)以及使用 reStructuredText 插件在 VS Code 中构建时,语法突出显示工作正常。
工作(本地)
不工作(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' 中没有太多诡计。
(见回购协议)
原因很简单。
我错误地将 'sphinx-rtd-theme' 的一个非常旧的版本固定在我的 'requirements.txt' 文件中。
我固定了版本 0.1.5 而不是最新的 0.5.1
我的本地环境只有更新的版本。
呸!
我在我的项目中使用 RTD + Sphinx (redgrease = https://github.com/lyngon/redgrease),代码块的语法突出显示似乎在 readthedocs.io 页面上不起作用。
它只在框中显示黑色文本。
例如见列表项目 3: https://redgrease.readthedocs.io/en/latest/intro.html#intro-redgrease
当我在本地构建(使用 sphinx-build)以及使用 reStructuredText 插件在 VS Code 中构建时,语法突出显示工作正常。
工作(本地)
不工作(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' 中没有太多诡计。 (见回购协议)
原因很简单。
我错误地将 'sphinx-rtd-theme' 的一个非常旧的版本固定在我的 'requirements.txt' 文件中。
我固定了版本 0.1.5 而不是最新的 0.5.1
我的本地环境只有更新的版本。
呸!