jquery.tocify.js icon indicating copy to clipboard operation
jquery.tocify.js copied to clipboard

Find all subheaders between headers regardless if they are siblings or children

Open BoPeng opened this issue 7 years ago • 0 comments

I encountered a similar problem with https://github.com/gfranko/jquery.tocify.js/issues/36. More specifically, I am adding TOCs to a bunch of jupyter notebooks whose headers are inside cells and have a structure like

cell -> h2
cell -> h3
cell -> h3
cell -> h2

tocify.js could not get the h3s because they are not children of h2. I checked the source code and find that this restriction is not really necessary so I modified the code to display all headers regardless if they are siblings or children.

The patch works but perhaps not using the best algorithm, but I would first like to know if there is any real reason for the restriction and if you are interested in merging the PR.

BoPeng avatar Jun 22 '18 18:06 BoPeng