-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fixed TOC nesting with non-sequential headings #1059
Conversation
This is awesome, thanks a lot! code lgtm, will wait for CI to pass then do a patch release with this. Ah it looks like the relevant test is failing, could you take a look? |
Of course, I'll take a look |
Actually wait to merge this in. I think we can have the best of both worlds. Gimme a second |
("a second == 4 hours later") I made the changes so both behaviors can co-exists. We only add empty nested items when appropriate. Here's what it would look like: for something like \toc
### Part of family 1: should not be nested `fd`
## Top-most ancestor of family 2
#### should be empty nested
### part of family 2
## Top-most ancestor of family 3
#### child1
#### child2
#### child3
#### child4
## Top-most ancestor of family 4
done. I've updated the test to include this. |
Haha who would have thought that tocs are so interesting 😂 thanks a lot for all your work! |
Of course, thank YOU for |
Hej! I have been using \toc without problems but after recent updates. It starts to create errors like this. Do you have any idea how I can fix this? Or is this a bug? Thanks! @mossr
|
When using
\toc
with a page that has nested headings that are not sequential, you currently get the following (which has h4 elements after h1 elements):Before
After
With this PR, I fix it so you skip adding empty nested lists to the TOC:
Egregious MWE
Here's a MWE that's pretty egregious:
Before
After
MWE
Note, this with the following
config.md