Skip to content

toc_depth affects RTD lateral TOC #2691

Open

Description

@Megver83

Description

So I just begun using MkDocs and it's so far great and super simple, which I loved because I'm kinda lazy about learning RST to use Sphinx. As I really like the RTD theme, and MkDocs has it built-in, I started to experiment with it and the python-markdown TOC extension.

However, I found that changing the toc_depth value of the extension affects the lateral TOC bar of the theme when it should not. E.g. I have this:

theme:
    name: readthedocs

markdown_extensions:
    - toc:
        permalink: True
        separator: "_"
        toc_depth: 2-6

Because the pages have a #h1 header for the title, which I don't want to display in the [TOC], only ##h2 headers and so on, but with this set up the lateral bar TOC of RTD (not the extension) will now only show me the ###h3 headers if there's an upper h2 before, otherwise nothing will be shown up but the +/- sign next to the title, with no effect.

This issue is not present in the lateral table of contents of the Material theme nor in rtd-dropdown, so this is surely a bug in the built-in MkDocs RTD theme.

Steps to reproduce

  1. Set the readthedocs theme
  2. Add the toc mk extension
  3. Set toc_depth from-to value, with "from" > 1
  4. Test a page with multiple headers

Activity

  1. added
    Theme-readthedocs
    on Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Theme-readthedocs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions