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 incorrectly nested when 4 header selectors are used and headers jump a level #23

Closed
grafana-dee opened this issue Apr 3, 2013 · 2 comments
Assignees
Labels

Comments

@grafana-dee
Copy link

For the given HTML:

<h1>Depth 1</h1>
<h2>Depth 2</h2>
<h3>Depth 3</h3>
<h4>Depth 4</h4>
<h5>Depth 5</h5>
<h3>Depth 3</h3>
<h2>Depth 2</h2>

And ToCify configured thus:

var toc = $("#toc").tocify({ selectors: "h2, h3, h4, h5" }).data("toc-tocify");

The generated menu will incorrectly nest the second Depth 3 as a sibling to Depth 4, rather than as a sibling to Depth 3.

I believe in the unminised code the bug is on line 411, but I don't know how to fix it.

@grafana-dee
Copy link
Author

Actually, the headers need no jump a level... this also exhibits the bug:

<h1>Depth 1</h1>
<h2>Depth 2</h2>
<h3>Depth 3</h3>
<h4>Depth 4</h4>
<h5>Depth 5</h5>
<h4>Depth 4</h4>
<h3>Depth 3</h3>
<h2>Depth 2</h2>

Maybe it's just having 4 header levels in the selector.

@gfranko
Copy link
Owner

gfranko commented Apr 7, 2013

This should now be fixed in the latest release!

@gfranko gfranko closed this as completed Apr 7, 2013
@ghost ghost assigned gfranko Apr 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants