Automatically create toctree for auto doc classes in Sphinx

I want to increase the documentation in one of my libraries. I used sphinx to create documentation and recently started learning the autodoc extension.

It appears that in most professional documents, each page of the documentation for documentation contains a list of all documented methods with links at the top. Or, in other words, a pointer at the top with hyperlinks to each more detailed documentation using the depth method.

Is there a way to automatically create this pointer for each of the classes documented with autodoc?

+7
python python-sphinx autodoc
source share
1 answer

In your conf.py file to add sphinx

 extensions = ['sphinx.ext.autosummary',] # NOTE: Don't overwrite your old extension list! Just add to it! autodoc_default_flags = ['members'] autosummary_generate = True 

I put toctree in my index.rst and it looks like this:

 ..autosummary:: :toctree: stubs Class1 Class2 Class3 

See this example for conf.py settings

and this example is for toctree example.

Hope this helps!

+3
source share

All Articles