Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
Thank you for this extension, it was just what I needed. Unfortunately, it did not correctly order the chapters for the project I was working on, which has an unusual structure:
application
,library
andtheory
then have numbered toctrees of their own. I wanted chapter numbers to start at 1. Introduction, work through the toctree in order, and end at 22. Bibliography. Instead I got alphabetical ordering by reference name. I think this is partly becauseenv.tocs
is alphabetically ordered, at least in Sphinx 4, but also because I have numbered toctrees inindex
surrounding other numbered toctrees in other files. Even a correctly orderedenv.tocs
wouldn't be able to correctly render this tree, as it is sorted on the file level.I solved this by walking the entire toctree, starting at
index
, and recording each numbered node in the order encountered. Then I just iterate over that list to number the tree. This should be pretty robust!I'm contributing this back to you with thanks and in the hopes that it's useful to you or someone else. If you'd like to merge it, I'd be happy to write a test to make sure the above bug doesn't recur!