-
Notifications
You must be signed in to change notification settings - Fork 217
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
Unexpected result when including h1 headers #36
Comments
It seems like testing toc generation would be simpler if the the selectors were limited to [startHeaderLevel, endHeaderLevel]. So something like: var toc = $("#toc").tocify({ startSelector: "h1", endSelector: "h5"}).data("toc-tocify"); |
Reading up on the html 5 documentation tags. https://developer.mozilla.org/en-US/docs/Web/HTML/Sections_and_Outlines_of_an_HTML5_document Something to note is that subsections can "restart" the header hierarchy. |
@oleersoy So this can be confusing, but the reason you are only seeing the
Specifying a starting and ending selector would limit some flexibility. For example, what if you only wanted to use
Very interesting. I like being able to set up |
Hi, Sorry for the late reply. I somehow missed the github email about this issue. I'm still getting up to speed on github, git, jquery, and jqueryui and reading your code has been very helpful. I hope to be able to submit pull requests soon. I think it would be helpful if there was a document like: That showed markup and correspondingly how the outline would be generated with respect to the markup. I'll write it up if you think it would be useful. |
@oleersoy No worries! That would be great if you could help contribute to this project. I also agree with you that there should be documentation around how the TOC is generated based on the HTML you are using. |
Cool - I'll start writing it up ASAP. |
Doing some research before starting beginning to write, and it turns out there's already an official spec for the algorithm that determines the document outline. The mozilla article sort of hints at it, but this makes it a lot more clear: http://coding.smashingmagazine.com/2011/08/16/html5-and-the-document-outlining-algorithm/ Do you think it's good enough to just reference this material? |
Tried this:
var toc = $("#toc").tocify({ selectors: "h1,h2,h3,h4,h5" }).data("toc-tocify");
Now only the first h1 header and its child shows up in the toc.
The text was updated successfully, but these errors were encountered: