sphinx-bootstrap-theme icon indicating copy to clipboard operation
sphinx-bootstrap-theme copied to clipboard

Could localtoc in sidebar support depth option?

Open 40huo opened this issue 7 years ago • 2 comments

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?

40huo avatar Nov 28 '17 09:11 40huo

Just like globaltoc_depth = 1.

40huo avatar Nov 28 '17 09:11 40huo

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

  1. theme.conf (adding localtoc_depth).
  2. 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.

svenevs avatar Dec 02 '17 22:12 svenevs