jimmynotjim / scrollnav

A dependency free JavaScript plugin for auto generating single page navigation
http://scrollnav.com
MIT License
461 stars 127 forks source link

Feature request: consider supporting a 3rd level of sections #106

Open atn832 opened 3 years ago

atn832 commented 3 years ago

So that one could see h1's, h2's and h3's in their page. Or it could be made generic to support any depth of nested headings.

jimmynotjim commented 3 years ago

Hey there, sorry for the delay. Due to work and personal schedules, I haven't been able to work on scrollnav in a long time and stopped working on new features entirely. If you'd like to make the necessary changes and send a PR I'd be happy to look them over. Thank you for understanding.

makrohard commented 3 years ago

I think it's better to talk about 'implementing infinite level depth' instead of 'implementng a 3rd layer'. That leads to the question of the interface.

Currently, the 1st level is specified in 'sections' and the second level in 'subSections'. I assume that the interface has to be kept stable, in order not to break existing installations when updating.

My proposal on that would be, that 'sections' will take an argument that consists of one or more space-separated html-tags. E.g: 'h1 h2 h3 h4 h5' or 'article section'.

Behaviour:

Any better ideas?

jimmynotjim commented 3 years ago

@makrohard that could make sense, but I'd prefer it to be in an array form so the plugin doesn't need to do much format checking. I'm open to a PR demonstrating this idea if you have the time to try it.