sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Add local TOC as right sidebar for #764

Open jdillard opened this issue 5 years ago • 3 comments

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

jdillard avatar May 07 '20 23:05 jdillard

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/

agjohnson avatar May 08 '20 15:05 agjohnson

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.

jdillard avatar May 08 '20 15:05 jdillard

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

net-sniper avatar Aug 17 '21 03:08 net-sniper