我为我构建的库提供了一些基于Sphinx的文档,除了changelog之外,我还想显示我所有页面的扩展目录。我想出了如何通过将changelog移动到第二个:toctree::来实现它,但是这有一些奇怪的行为。主要是,当我访问页面时,changelog会出现在不同的项目列表中,当我使用侧栏导航时,我只能在每个toctree中导航(如果我单击changelog,就不会在侧边栏上显示其他部分)。有更好的方法吗?
我现在要说的是:
.. toctree::
:maxdepth: 5
getting_started
examples
modules
.. toctree::
:maxdepth: 1
changelog
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`发布于 2020-10-15 09:44:38
通过使用读文档模板,您可以实现这一点。您还必须操作_static目录中的_static文件。简单地添加
.rst-content .toctree-wrapper:not(:last-child) ul {
margin-bottom: 0;
}这两棵独立的树看起来像一棵树,它们将显示在侧栏中。
对于其他Sphinx模板,对呈现的html的检查可能会引导您找到正确的css选择器。但我不知道这些模板是如何处理侧栏的。
https://stackoverflow.com/questions/56195758
复制相似问题