Sphinx: Tree doesn't include subsections for `self` in toctree

Created on 31 Oct 2015  路  5Comments  路  Source: sphinx-doc/sphinx

Most helpful comment

Workaround: add the index page explicitly to the TOC. E.g. If your master document is called index, do something like:

.. toctree::
    :maxdepth: 2

    index
    tutorial
    ...

Note that without :maxdepth: the TOC entries itself are shown inside the TOC itself recursively once. Also, there are warnings on the console:

/home/raskolnikov/dev/immer/doc/index.md:: WARNING: circular toctree references detected, ignoring: index <- index

All 5 comments

Since the appearance of self in 38e766c2, it always only includes the title of the current file. not whole of ToC of the file.

@birkenfeld What is the purpose of the keyword? It seems not enough to use as "sitemap". So I don't know how to use this feature.
Could you tell me your idea?

TBH, I don't know anymore :)

I stumbled across the same issue - including self in the toctree only inserts a single link to the same document (irrespective of maxdepth), so I don't see how this could be used to generate a sitemap or a document-local ToC (which is what I'm after).

Using the plain reStructuredText .. contents:: directive is _somewhat_ of an alternative, but doesn't have the same features as Sphinx's toctree (e.g. no numbering support).

Workaround: add the index page explicitly to the TOC. E.g. If your master document is called index, do something like:

.. toctree::
    :maxdepth: 2

    index
    tutorial
    ...

Note that without :maxdepth: the TOC entries itself are shown inside the TOC itself recursively once. Also, there are warnings on the console:

/home/raskolnikov/dev/immer/doc/index.md:: WARNING: circular toctree references detected, ignoring: index <- index

Oh no! My workaround has one mayor drawback: in the sidebar TOC, when you are in a page other than the index, the Index page entry itself is "opened" and the part of the document where the toc is included is highlighted. Example:

screenshot from 2016-11-09 00-30-03

Was this page helpful?
0 / 5 - 0 ratings