jgallen23 / toc

Table of Contents Plugin
http://projects.jga.me/toc/
MIT License
531 stars 111 forks source link

Inserting anchor element before headline breaks CSS "+" Selector #47

Open jdittrich opened 9 years ago

jdittrich commented 9 years ago

Inserting the anchor element before headline introduces an additional element between different headlines and/or paragraphs and headlines which breaks CSS stylesheets using the "+" selector (Select consecutive elements).

Possible Solution: Could the anchor be appended to the headline itself? So instead of <span id="toc4"></span><h3>Options</h3> it would create a <h3>Options<span id="toc4"></span></h3>?

patrickcate commented 4 years ago

Ran into this issue myself. I'd suggest just putting the ID directly on the header element:

<h3  id="toc4">Options</h3>

Looks like with https://github.com/jgallen23/toc/pull/60 already has this fix.