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

Collapsing ToC and ToC Depth Configuration #15

Closed
wants to merge 8 commits into from
Closed

Collapsing ToC and ToC Depth Configuration #15

wants to merge 8 commits into from

Conversation

SinisterMinister
Copy link

Addresses #14 and then some.

Collapsable ToC

So right now, it defaults to disabled as that's the current implementation. To enable it, you can do so globally by setting extra.collapse_toc to true in your mkdocs.yml like so:

site_name: Nibiru Documentation
pages:
  - Home: index.md
  - Guides:
    - OpenStack Support: guides/openstack-support.md
theme: cinder
extra:
  collapse_toc: true

This will enable it site-wide. You can also use page-specific overrides by adding collapse_toc to the meta section of your page's markdown like so:

collapse_toc: true

# OpenStack Support
<small>Author: Codey Whitt</small>

## Differences Between AWS and OpenStack

There are only a handful of differences that could potentially cause you headaches while working with OpenStack instances and they are mostly edge cases. We'll start with the only one that isn't.

This way you can enable/disable it site-wide as well as override it on a page by page basis. You can have it enabled site-wide and disabled on individual pages or have it disabled site-wide and enabled individually as well.

Tunable ToC Depth

The other thing I added since I needed more levels in my ToC was the ability to tune the number of levels shown in the ToC. I used the same pattern as before with the ToC collapsing as well. Here it is via mkdocs.yml:

site_name: Nibiru Documentation
pages:
  - Home: index.md
  - Guides:
    - OpenStack Support: guides/openstack-support.md
theme: cinder
extra:
  toc_depth: 4

And here it is on a page level:

toc_depth: 2

# OpenStack Support
<small>Author: Codey Whitt</small>

## Differences Between AWS and OpenStack

There are only a handful of differences that could potentially cause you headaches while working with OpenStack instances and they are mostly edge cases. We'll start with the only one that isn't.

@SinisterMinister
Copy link
Author

SinisterMinister commented Apr 22, 2016

So, the screenshots won't look right until #16 is merged in. Once it is, things will look right.

screen shot 2016-04-22 at 2 03 23 pm

@gokr
Copy link

gokr commented Aug 15, 2016

Just wanted to mention that I want this stuff too! My doc is also too long ... http://www.sprylang.org

@chrissimpkins
Copy link
Owner

chrissimpkins commented Mar 12, 2018

Thanks for all of this work! Will require a rebase on the changes made to support MkDocs project changes in order to merge this. Feel free to reopen if you are able to do this work. Sorry...

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.

3 participants