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

Could localtoc in sidebar support depth option? #169

Open
40huo opened this issue Nov 28, 2017 · 2 comments
Open

Could localtoc in sidebar support depth option? #169

40huo opened this issue Nov 28, 2017 · 2 comments

Comments

@40huo
Copy link

40huo commented Nov 28, 2017

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
Copy link
Author

40huo commented Nov 28, 2017

Just like globaltoc_depth = 1.

@svenevs
Copy link
Collaborator

svenevs commented Dec 2, 2017

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.

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

No branches or pull requests

2 participants