gfranko / jquery.tocify.js

A jQuery Table of Contents plugin that can be themed with Twitter Bootstrap or jQueryUI.
http://gregfranko.com/jquery.tocify.js/
MIT License
927 stars 217 forks source link

Indentation break #3

Closed juristr closed 12 years ago

juristr commented 12 years ago

Hi,

another bug :) I noticed that when having a structure like

<h1>
       <h3>
   <h2>
   <h2>

the indentation is broken. Here's the according JSBin sample.

gfranko commented 12 years ago

The indentation rules within the tocify.css stylesheet are based on the number of nested subheaders. Since the h3 tag is the first nested subheader, it will be indented as such. It does not care that it is an h3 tag, just what nesting level it is.

juristr commented 12 years ago

Sure, that's fine, but the subsequent h2 headers are not indented at all but they are at the same level as the h1 tag.

gfranko commented 12 years ago

That's because the table of contents expects an h2 element to come before an h3 element. The order is very important. I believe it is fine to be stringent on the order, since it is very easy to customize the size of header elements using CSS.