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

Toc numbering is weird when using defaults: numbered: true #47

Closed
AakashGfude opened this issue Jun 24, 2021 · 13 comments
Closed

Toc numbering is weird when using defaults: numbered: true #47

AakashGfude opened this issue Jun 24, 2021 · 13 comments
Assignees

Comments

@AakashGfude
Copy link
Member

When I use

defaults:
  numbered: true

globally in _toc.yml, some of the files are not numbered. And this changes with the number of times I run the build.

The screenshot is when I ran the build the first time:
Screen Shot 2021-06-24 at 2 20 06 pm

The warnings I got during the build:

Screen Shot 2021-06-24 at 2 25 35 pm

@AakashGfude AakashGfude self-assigned this Jun 24, 2021
@chrisjsewell
Copy link
Member

chrisjsewell commented Jun 24, 2021

Yeh you shouldn’t use defaults for numbering you should use options:

options:
  numbered: true

@chrisjsewell
Copy link
Member

This is already warned about in the sphinx-external-toc documentation: https://sphinx-external-toc.readthedocs.io/en/latest/user_guide/sphinx.html#toc-tree-options

Can you make sure it’s correct in the jupyter-book documentation

@AakashGfude
Copy link
Member Author

AakashGfude commented Jun 24, 2021

@chrisjsewell Yes, I did read about that warning. But I think options can be used only at the level of a subtree. I was trying it in jupyter-book docs which has multiple parts as child tocs. I could not find any global way of numbering apart from the defaults key for that configuration.

@choldgraf
Copy link
Member

I believe that defaults: will effectively add the numbered: true option to all nested toctrees, whereas options will apply only to the top-level toctrees (which is why options is the correct one to use here).

@AakashGfude
Copy link
Member Author

@choldgraf in the case of projects with multiple parts like jb docs, if I use options in the top root level, the numbering does not take effect, I have to individually number each part. As options work on the subtree level. https://github.com/executablebooks/sphinx-external-toc#toc-tree-options .

So is it encouraged to number each individual subtrees explicitly, instead of having a global numbering that numbers all subtrees?

@AakashGfude
Copy link
Member Author

Can you make sure it’s correct in the jupyter-book documentation

@chrisjsewell should we remove the defaults: numbered: true section from the jb doc then? https://github.com/executablebooks/jupyter-book/blob/master/docs/structure/configure.md#number-your-chapters-and-sections

@AakashGfude
Copy link
Member Author

Yeh you shouldn’t use defaults for numbering you should use options:

options:
  numbered: true

This does not work on the root-level of jb docs as I have mentioned in the comments above. It only works with individual parts.

@chrisjsewell
Copy link
Member

So is it encouraged to number each individual subtrees explicitly, instead of having a global numbering that numbers all subtrees?

basically yep. Obviously you are welcome to submit a PR to sphinx-external-toc to propose any improvements to this; but it is just a shortcoming of sphinx, that you cannot add numbering to all nested subtrees without it complaining

@mmcky
Copy link
Member

mmcky commented Jun 25, 2021

Can you make sure it’s correct in the jupyter-book documentation

@chrisjsewell should we remove the defaults: numbered: true section from the jb doc then? https://github.com/executablebooks/jupyter-book/blob/master/docs/structure/configure.md#number-your-chapters-and-sections

Hey @AakashGfude - Yes we should remove that from the docs and encourage numbering all parts for chapter/part structures.

@chrisjsewell
Copy link
Member

there probably is a way to code it into sphinx-external-toc, its just not trivial. also perhaps there should be a warning if someone does put numbering in the defaults

@choldgraf
Copy link
Member

I'm a +1 on just putting a warning if numbered is in the defaults.

@AakashGfude I'm happy to review a PR to the docs that clarifies this and shows the proper way to do numbering

@mmcky
Copy link
Member

mmcky commented Jul 1, 2021

@choldgraf I have added some further details to jupyter-book/jupyter-book#1326

  • update sphinx-external-toc to issue a warning

@mmcky mmcky transferred this issue from jupyter-book/jupyter-book Jul 1, 2021
@mmcky
Copy link
Member

mmcky commented Jul 1, 2021

duplicate of #45

@mmcky mmcky closed this as completed Jul 1, 2021
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

4 participants