scrollnav
scrollnav copied to clipboard
Feature request: consider supporting a 3rd level of sections
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.
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.
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:
- If none is present it default to h2 (current behaviour)
- If exactly one is present, use it as first level, check subSections for second level
- If more than one is present, use them in the given order as levels. Ignore subSection.
Any better ideas?
@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.