auto-numbered table of contents

23 views
Skip to first unread message

Phillip M. Feldman

unread,
Jan 22, 2020, 8:02:48 PM1/22/20
to sphinx-users
I would like to create a numbered table of contents in which the title of the first module in the TOC begins with a 1, the next with a 2, and so on.  So, the TOC would look like this:

1. module_X

   1.1 function xa
   1.2 function xb

2. module_Y

   2.1 function ya
   2.2 function yb

Is it possible to generate a TOC that looks like the one above, with Sphinx automatically doing the folloinwg: (a) numbering the modules, and (b) inserting the module number and a dot in front of the title of each section within each module?  If it is possible, does anyone have an example that shows how to do this?

Stefano David

unread,
Jan 23, 2020, 6:40:25 AM1/23/20
to sphinx-users


On Thursday, 23 January 2020 02:02:48 UTC+1, Phillip M. Feldman wrote:

Is it possible to generate a TOC that looks like the one above, with Sphinx automatically doing the folloinwg: (a) numbering the modules, and (b) inserting the module number and a dot in front of the title of each section within each module?  If it is possible, does anyone have an example that shows how to do this?
This is by default in latex, for html check the options for toctree in the docs: http://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#toctree-directive

HTH,
Stefano

Komiya Takeshi

unread,
Jan 25, 2020, 11:19:32 AM1/25/20
to sphinx...@googlegroups.com
Hi,

At prensent, autodoc does not support to generate TOC entry. So you
need to write section headers to each modules and functions manually.
We have a feature request for this purpose. But there are no time to
implement it.

Note: https://github.com/sphinx-doc/sphinx/pull/7004 is one of
experimental implementation for this.

Thanks,
Takeshi KOMIYA

2020年1月23日(木) 10:02 Phillip M. Feldman <phillip....@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/83bbf0e4-f76c-4025-b0a4-1fe646a233f4%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages