John Goofy
John Goofy

Reputation: 1419

How to adjust the right hand toc depth in Jupyter Book

Is it possible to adjust the right hand table of contents depth, named as Contents, in Jupyter Book's HTML output? I want to view every header I've written in a Jupyter Notebook.

By default it only shows up to a depth of two and shows deeper levels only if I scroll down. I haven't found any hint in the documentation.

I'm generating my _toc.yml with

jupyter-book toc from-project . --extension .ipynb -e .md -f jb-book > _toc.yml

This is the content of my _toc.yml:

format: jb-book
root: index
chapters:
- file: 000_001_notebooks
- file: 000_002_markdown
- file: 000_003_markdown-notebooks
- file: 001_000_print
- file: 001_001_variables
- file: 900_000_matplotlib

Upvotes: 0

Views: 111

Answers (1)

iff_or
iff_or

Reputation: 929

I also can't tell from the documentation whether there's a configuration I'm to set re: default depth displayed in the righthand sidebar, but my workaround is to override the display value in my custom CSS file:

ul.nav.section-nav.flex-column {
  display: block;
}

Re: depth, I don't know why you might be seeing only two levels in that sidebar. When I tested it just now, removing all CSS rules except the above (and with maxdepth: 3 set in _toc.yaml), all depths through h6 showed up. You might be able to discern why by using developer tools to inspect the <li> children of div.sidebar-secondary-items.

Upvotes: 0

Related Questions