Skip to content

Add header before module contents docs when showing summaries #351

Open
@sammorley-short

Description

@sammorley-short

Currently, if you include the option show-module-summary, then for themes with contents sidebars (such as jupyter-book), then the lack of a new header before the full module contents docs (i.e. after the last module summary section) means that the page's hierarchy is mis-represented.

For example, take the following module, containing a class, attribute and function:

Screenshot 2022-09-21 at 22 31 45

Here we can see the right-hand sidebar displays the contents as one would expect, with each docs entry being a new section in the contents.

However, if we turn on module summaries, we get the following:

Screenshot 2022-09-21 at 22 31 17

Here we can see that the docs entries are displayed as being contents within the last of the module summary sections (in this case Attributes, rather than being listed either as at the same hierarchy as the summary sections, or within a new section, thereby indicating they're not within Attributes.

I'm not sure what the preferred fix for this would be, but probably the most consistent thing would be to move the summary sections into a section above Module Contents, such as Module Summary, and then have the contents be subsections of Module Contents (as it they are in the non-summary case).

For example, in the above example the new section header structure would be as follows:

# Module Summary
## Classes
## Functions
## Attributes
# Module Contents
## Foo
## bar
## baz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions