Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jdillard
Copy link

@jdillard jdillard commented May 7, 2020

This PR adds a table of contents for the local headings on the page (excluding the page title) as a right sidebar, as mentioned in #764. This implementation is similar to the one in GitLab's Handbook in that is moves the local TOC to the top of the page on smaller screens.

You can see my downstream implementation as a live demo here: https://docs.netgate.com/pfsense/en/latest/vpn/scaling.html

This PR is viewable at https://sphinx-rtd-theme--919.org.readthedocs.build/en/919/

Preview:

local-toc-sphinx-rtd-theme

@agjohnson
Copy link
Collaborator

Thanks for giving a try on this! I tried this same thing a while back and it looked promising, but did introduce some UX issues with the existing global toc. We'll want to address these sort of issues and put this all under a configuration setting, but I think calling {{ toc }} directly is the way to go with a secondary side nav. I'll also have some feedback on css styles, i think we can reduce that a good deal and make the side nav more subtle.

To start, can you run python setup.py build to regenerate the built CSS so we can review the changes? This PR is viewable at https://sphinx-rtd-theme--919.org.readthedocs.build/en/919/

@jdillard
Copy link
Author

jdillard commented May 8, 2020

Thanks for giving a try on this! I tried this same thing a while back and it looked promising, but did introduce some UX issues with the existing global toc. We'll want to address these sort of issues and put this all under a configuration setting, but I think calling {{ toc }} directly is the way to go with a secondary side nav.

No problem! Yea, having the ability to turn the local TOC off, at a minimum, would be nice.

I'll also have some feedback on css styles, i think we can reduce that a good deal and make the side nav more subtle.

For sure, CSS isn't exactly my strong suit so there are probably some leftovers from all the trial and error.

To start, can you run python setup.py build to regenerate the built CSS so we can review the changes?

This has been done now and pushed.

@agjohnson agjohnson added this to the 0.7 milestone May 8, 2020
@Blendify Blendify requested a review from a team March 21, 2021 02:27
@Blendify Blendify modified the milestones: 0.7, 1.1 Mar 21, 2021
Copy link
Member

@Blendify Blendify left a comment

Choose a reason for hiding this comment

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

We will want this to be a theme option, to start out at least.
When the option is enabled I think theme_includehidden should be forcible disabled.
This should solve the UX of using both the global toc and local toc together.

The css side seems okay, there should be a way to collapse the local toc when the page is narrow.

@net-sniper
Copy link

Great functionality, but I don't know how to configure it?

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.

5 participants