bootstrap-toc
bootstrap-toc copied to clipboard
If header starts with a number, scrollspy not works
If header starts with a number, script creates an id with a number at the beginning, which is wrong. In html id can't start with a number. It would also be nice to strip all html entities (e.g. &) from id.
I just noticed this as well.
For some reason this was ok:
<h2 id="2016aidsheader" class="pt-5">2016 AIDS Conference</h2>
But this, nested within another h2 was not:
<h3>508 Memorial</h3>
¯_(ツ)_/¯
I might be experiencing something similar as scrollspy does not pass the sections with parenthesis on page https://bioworkflows.com/ictr/COVID19-outbreak-simulator-model/2 .
Edit: I think I encountered the same problem with this stackoverflow post. The problem is that the IDs are generated by bootstrap-toc, not by me, so it should perhaps remove ( and ) in the first place.
Edit: It turns out that the document came with IDs that contains ( and ), in which case bootstrap-toc will simply use existing IDs. I think what bootstrap-toc is doing is correct because the IDs might be used by the document, but scrollspy does fail to work because of this. I have tried to fix it by adjusting the ID in the document.