我希望在使用时能够链接到侧边栏中自动生成的索引sphinx-rtd-theme.我已经尝试将它添加到toctree:
.. toctree::
first
second
Index <:ref:`genindex`>
Run Code Online (Sandbox Code Playgroud)
但这导致了
WARNING: toctree contains reference to nonexisting document u':ref:`geinindex`'
Run Code Online (Sandbox Code Playgroud)
从狮身人面像,没有其他影响.
我想我可以简单地在主题layout.html文件中对索引进行硬编码,但也许有更好的方法,而不是涉及修改标准主题?
TIA任何提示!
我正在使用他们的主题在 ReadTheDocs 上使用 Sphinx 创建我的文档。构建过程会生成一个 genindex.html 文件,可以通过以下方式引用:
Link to the :ref:`genindex` page.
Run Code Online (Sandbox Code Playgroud)
这创造了:
链接到索引页面。
我无法添加genindex到我的 toctree,例如像这样:
.. toctree:
foo
bar
genindex
Run Code Online (Sandbox Code Playgroud)
因为它是一个自动生成的文件,在渲染时不存在。此外,Sphinx 期望 genindex 是一个名为genindex.rst.
如何将其添加到我的 ToC/导航中?
indexing restructuredtext python-sphinx read-the-docs toctree