Modify Sphinx TOC tree
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a Sphinx project with a TOC ( index.rst ) that includes :maxdepth: 2 . The problem is I want to reduce the depth to 1 for the release section so that it doesn't include the list of release notes in the main TOC (the list is too long). It seems that the TOC list can be modified using a doctree-resolved event handler, but I can't figure out how to modify the TOC tree in the event handler: from sphinx import addnodes def setup ( app ): def update_toctree ( app , doctree , docname ): if docname != 'index' : return node = doctree