sphinx-bootstrap-theme
sphinx-bootstrap-theme copied to clipboard
Could localtoc in sidebar support depth option?
For a page contains lots of headings and subheadings, if we generate localtoc in sidebar, the sidebar would be too long to display and it doesn't support scroll well, sometimes even overflows the footer. So, could localtoc support a depth
option and then we can control the length of sidebar?
Just like globaltoc_depth = 1
.
Hi @40huo, it shouldn't be too painful to support this. PR would be welcome, in the PR it would be nice if you included a simple demo website.
You mention a specified page. Adding localtoc_depth = X
would be a global setting. One thing you might try before jumping in on this is to see if you can use the miscellaneous markup for :tocdepth:
on the page in question. You put these meta-tags at the top of the reStructuredText document:
:tocdepth: 2
My First Heading
================
The rest of the document...
However, I believe that will affect both the global and local toc. But worth a shot since it's easy to test!
If you want to do give it a go, you'll need to edit
-
theme.conf
(addinglocaltoc_depth
). - Edit this part of
navbar.html
.
Currently, it looks like localtoc.html
is not actually used, but instead it's getting done in navbartoc.html
. I'm not really sure. But basically, you'd need to play around, the resultant localtoc.html
should probably get included instead. You should use globaltoc.html
as a reference.