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

I'm trying to setup the table of contents to just show the thesis level, but nothing lower #3

Open
RolfHut opened this issue Nov 18, 2024 · 10 comments

Comments

@RolfHut
Copy link
Contributor

RolfHut commented Nov 18, 2024

I'm trying to setup the table of contents to just show the thesis level, but nothing lower and I'm failing. if I read the docs right, maxdepth should do the trick, but I must be doing it wrong.

@BSchilperoort
Copy link
Member

The ToC on the left is not the same as the toc you add to the index page, confusingly. The readthedocs theme does pull from that (e.g. in the eWaterCycle docs).

After a quick search I found this: https://sphinx-book-theme.readthedocs.io/en/stable/sections/sidebar-primary.html#control-the-depth-of-the-left-sidebar-lists-to-expand on the docs of the sphinx book theme.

The sphinx ecosystem is very messy.

@RolfHut
Copy link
Contributor Author

RolfHut commented Nov 19, 2024

Hmm, it says as a solution to edit conf.py but I guess that lives deep in a dependency and not in your own repo?

@BSchilperoort
Copy link
Member

Oh yeah I guess that's created during the build...

The jupyter book config does indeed say to use maxdepth https://jupyterbook.org/en/stable/structure/configure.html#control-the-depth-of-the-displayed-table-of-contents

Maybe try

format: jb-book
root: intro.md
options:
  maxdepth: 1

parts:
  - caption: Thesis Projects
...

@Tom-van-Woudenberg
Copy link

Tom-van-Woudenberg commented Nov 19, 2024

maxdepth is only for a 'within-page Table of Contents', I think what you want is to have the TOC only contain the files that you want to be there and link to other files which are not included there. Make sure you have the following options disabled:

only_build_toc_files: false

in your _config.yml

@BSchilperoort
Copy link
Member

I think what you want is to have the TOC only contain the files that you want to be there

The problem is that other headers from inside the notebooks are being displayed in the ToC. Rolf wants those to not show up.

@Tom-van-Woudenberg
Copy link

The problem is that other headers from inside the notebooks are being displayed in the ToC. Rolf wants those to not show up.

In the table of contents on the left or on the 'within-page Table of contents'?

@BSchilperoort
Copy link
Member

the table of contents on the left

the one on the left sidebar

@Tom-van-Woudenberg
Copy link

the one on the left sidebar

Hmm, I don't see why/how/where headers from inside the notebook which are on the level of ## or lower are displayed there. Headers with # are displayed there for sure, but you can prevent that from happening by not having those files in the TOC as mentioned here: #3 (comment)

@RolfHut
Copy link
Contributor Author

RolfHut commented Nov 19, 2024

the thing is, I do want to have the nav buttons at the bottom of the page for "next" and "previous", but not show the final level in the toc on the left of the page... sorry of the problem is not clear.

@Tom-van-Woudenberg
Copy link

the thing is, I do want to have the nav buttons at the bottom of the page for "next" and "previous", but not show the final level in the toc on the left of the page... sorry of the problem is not clear.

Aha. Well I think the nav buttons are a result from the TOC, so you cannot have them without inclusion of the file in the TOC

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

No branches or pull requests

3 participants