【问题标题】:Exclude current document sections from sphinx toctree从 sphinx toctree 中排除当前文档部分
【发布时间】:2022-01-17 15:24:38
【问题描述】:

我有第一个文件,例如:

######
Title
######

.. toctree::
  :hidden:
  :titlesonly:

  subpage1
  subpage2
  subpage3

Section1
---------

Section2
---------

这会导致目录树

 Title
  subpage1 title
  subpage2 title
  subpage3 title
  Section1
  Section2

有没有办法从目录树中删除 Section1Section2 - 我想要它,只有我明确声明的内容

【问题讨论】:

  • Section1 和 Section2 不在 toctree 指令中。当您呈现为 HTML 时,将呈现 toctree,然后是两个部分标题。如果您不想要这些标题,请将其删除。
  • .. toctree::的缩进错误。
  • @mzjn - 谢谢。我固定了,我想

标签: python-sphinx toctree


【解决方案1】:

似乎在父文档 toctree 指令中添加:titlesonly: 达到了我想要的效果。

【讨论】:

  • 你到底做了什么改变?您的问题中已经有:titlesonly:
  • 我将 :titlesonly: 添加到 parent 文档目录树
  • 问题中没有“父文档”。我仍然不明白问题是什么以及如何重现它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-10-06
  • 1970-01-01
  • 1970-01-01
  • 2014-10-30
  • 2012-09-07
  • 2015-03-14
  • 1970-01-01
相关资源
最近更新 更多