Skip to content

Ensure correct numerical sorting of TOC when chapters exceed 10#73

Open
adiprnm wants to merge 3 commits intofnando:mainfrom
adiprnm:fix/toc/invalid-order-when-more-than-9-chapters
Open

Ensure correct numerical sorting of TOC when chapters exceed 10#73
adiprnm wants to merge 3 commits intofnando:mainfrom
adiprnm:fix/toc/invalid-order-when-more-than-9-chapters

Conversation

@adiprnm
Copy link

@adiprnm adiprnm commented Nov 12, 2025

This PR solves the order of the TOC when there are more than 10 chapters, so the generated HTML would be like this:

section_0.html section_1.html section_10.html section_2.html section_3.html ...

The write_toc! depends on the order of the section's HTML, thus wrong ordering results in an invalid ToC ordering.

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller
    PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into
    two PRs otherwise).
  • This PR's title starts is concise and descriptive.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or
    fixes.
  • I've updated any docs, .md files, etc… affected by this change.

What

  • Make the section number consistent by adding one leading zero if it's below 10
  • Start the section number from 1 instead of 0

Why

It's a bug that needs to be solved.

Known limitations

N/A

@adiprnm adiprnm requested a review from fnando as a code owner November 12, 2025 06:44
@adiprnm adiprnm changed the title Ensure correct numerical sorting of TOC when chapters exceed 9 Ensure correct numerical sorting of TOC when chapters exceed 10 Nov 12, 2025
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.

1 participant