aig*_*fer 6 python python-sphinx toctree
我为我构建的库提供了一些基于 Sphinx 的文档,我想显示除更改日志之外的所有页面的扩展目录。我想出了如何通过将更改日志移动到 second 来做到这一点:toctree::,但这有一些奇怪的行为。主要是,当我访问页面时,更改日志会显示在不同的项目符号列表中,而当我使用侧边栏导航时,我只能在每个目录树中导航(如果我单击更改日志,我将不会在侧边栏上显示其他部分)。有一个更好的方法吗?
这是我现在所拥有的:
.. toctree::
:maxdepth: 5
getting_started
examples
modules
.. toctree::
:maxdepth: 1
changelog
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Run Code Online (Sandbox Code Playgroud)
通过阅读文档模板,您可以实现这一目标。您还必须操作_static目录中的style.css文件。只需添加
.rst-content .toctree-wrapper:not(:last-child) ul {
margin-bottom: 0;
}
Run Code Online (Sandbox Code Playgroud)
两个单独的目录树看起来就像一棵,它们将显示在侧栏中。
对于其他 Sphinx 模板,检查渲染的 html 可以引导您找到正确的 css 选择器。但我不知道这些模板如何处理侧边栏。