1

Is there any option to use labels in sphinx-autosummary toctree? Sphinx can build a toctree such as:

.. toctree::

  Main page <module.main>

The above will display "Main page" in the TOC of the HTML document. I would like the same using autosummary toctree

.. autosummary::
  :toctree:
  
  Main page <module.main>

However, the above label produces: module\main.rst: WARNING: document isn't included in any toctree

The purpose of this, when the html page is generated the TOC shows:

module package
   module.main module

What I want to see is:

module package
   main module

I am not even sure that this is the right place to achieve the above rendering

Yulian
  • 11
  • 4
  • If you try just `module.main`, do you get the same warning? Also to which file does the warning refer? Usually it pertains to `.rst` files, not Python (or whatever language) modules. – Steve Piercy Feb 03 '21 at 05:42
  • For autosummary toctree, when I use module.main it works. Please see the updated explanation. – Yulian Feb 04 '21 at 18:20
  • 1
    It looks like you are confusing the `.. toctree::` *directive* and the `:toctree:` *option*. The entries of a `.. toctree::` directive are names of RST files. The entries of an `.. autosummary::` directive are names of Python objects (classes, functions). The `:toctree:` option on `autosummary` takes one argument: the name of the directory where Sphinx saves autogenerated RST files. See https://stackoverflow.com/q/27350467/407651. – mzjn Feb 05 '21 at 05:05

1 Answers1

0

I have found out where this whole issues is coming from. The cause isn't in the toctree but the titles of each rst file. I use apidoc and autosummary. The apidoc has a template pacakge.rst that builds a toctree and it uses the titles of the generated .rst files to display the name in the *.html.

By title I mean, if you open the autosummary/module.rst:

{{ fullname | escape | underline }}

Yulian
  • 11
  • 4