Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add show_toc_level config option to choose visible levels of toc #256

Merged
merged 2 commits into from Sep 28, 2020

Conversation

choldgraf
Copy link
Collaborator

@choldgraf choldgraf commented Sep 23, 2020

This adds the ability to show deeper levels of the in-page TOC if users wish.

See the documentation demo for how this works.

closes #237

@jorisvandenbossche jorisvandenbossche changed the title adding toc level chooser ENH: add show_toc_level config option to choose visible levels of toc Sep 26, 2020
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks!

.. code-block:: python

html_theme_options = {
"show_toc_level": 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "2" here might be a bit confusing with the above "only the 2nd-level headers ..." ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I wasn't quite sure what was the most intuitive thing to use here. The "2" could either refer to the level of the header in the document, OR it could refer to the level of the in-page TOC to the right. AKA the confusion is because the 2nd-level of the in-page TOC refers to the third level headers on the page. Do you have an intuition for which would be less-confusing for people?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as config value, "2" is certainly fine here, in the meaning: "show 2 levels in the toc", which I think is the clearest definition (you don't need to know how to start counting the levels, include the main title as 1st level or not?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, if there are multiple 1st level headers, it are actually those that are shown in the TOC. It's only the 2nd level headers that are shown if there is a single main title. So maybe it's better to speak about "only the 1st level headers (after the main title) of a page are shown"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the language that you added, to make it clear that the configuration is for how many TOC levels are displayed (whether they begin with first-level headers or second-level headers, it'll remain consistent then)

Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: be able to configure the number of levels in the page TOC
2 participants