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

Use recursive navigation numbering #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bittorala
Copy link

@bittorala bittorala commented Feb 20, 2025

When using deeply nested sections, the numbering of the headings started to get messy. This is the problem at the core of issues #83, #111 and #123, which I believe would be fixed by this PR.

This PR revamps the ToC generation, both on the sidebar and the printed page, to always navigate the sections recursively and provide a predictable, simple, "classic" (as per this comment) numbering scheme.

It also works on and expands the scope of PR #115, as it has been frozen for quite some time, and its scope was slightly more limited.

Besides, total line count has been greatly reduced, and some aspects of the code have been simplified.

Note, however, that here we have opted to leave the inner headings outside the ToC of the printed document
This was done to keep the print page ToC consistent with the sidebar ToC, but this is different from the original approach. It could be discussed whether including the inner headings in the print-page ToC is desired (and whether the sidebar should be consistent with this).

Little example (left is old, right is new):
image

Another example (based on PR #115).

Old sidebar (omits elements and has obscure numbering):
sidebar-old

New sidebar:
sidebar-new

When using deeply nested sections, the numbering of the headings
started to get messy. See
[GitHub issue](timvink#123).

This commit revamps the TOC generation, both on the sidebar and the printed
page, to always navigate the sections recursively and provide a
predictable, simple, "classic"
(as per [this
comment](timvink#115 (comment)))
numbering scheme.

This commit also works on and expands the scope of
[this PR](timvink#115),
as it has been frozen for quite some time, and its scope was slightly
more limited.

Besides, total line count has been greatly reduced, and some aspects
of the code have been simplified.

Note, however, that here we have opted to leave the inner headings
outside the TOC of the printed document, thus keeping it consistent
with the sidebar TOC, but this is different from the original approach.
It could be changed in future commits.
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