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

Not detecting headings in a-tags #50

Closed agez closed 10 years ago

agez commented 10 years ago

I've got some html code from another system I have to render.

The html code has a certain structure which tocify can apparently not correctly analyse. Only the first heading is rendered in the toc. In the case I want tocify h1,h2,h3 I only see "Section 1 - H1" in the toc. The problem seems to be that the headings are inside of a-tags.

<article>
            <section>
                <a name="section1_h1">
                <h1>Section 1 - H1</h1>
                </a>
                <section>
                    <a name="section11_h2">
                    <h2>Section 1.1 - H2</h2>
                    </a>
                    <section>
                        <a name="secton1_h3">
                        <h3>Section 1.1.1 - H3</h3>
                        </a>
                    </section>
                </section>
                </section>
        </article>

If I put the a-tags inside the headings everything's fine. But changing the html is out of my scope :-(

Is there a fix or workaround for this issue?

Thanks!

gfranko commented 10 years ago

Unfortunately, I'm not sure of a good workaround at the moment. Tocify expects other headers (that are associated with it) to be siblings or children. See #36