duplicated entries in toc not functioning properly
chiwhalee opened this issue · 6 comments
When I have a toc like the following:
- HEAD_A
1. a
2. b - HEAD_B
- a
- c
If I press 'a' under HEAD_B, it can only jumps to the place where the 'a' under HEAD_A points to. Of course one could distinguish the two 'a' by giving them different names, but this makes the string longer and not clear.
Each heading gets an id based of its content text. HTML IDs must be unique. If there's more than one element with the same ID, visiting the #id
hash will navigate to the first. The toc extension doesn't set the IDs, IPython does.
Is there a workaround for this issue? e.g. let those id generated not just by "a" but by "#HeaD_A#a". Do you plan to improve this?
In the toc extension, while walking IDs to build the toc tree, it would be possible to keep track of seen IDS, and de-duplicate the IDs. It might be tricky to add to IPython itself, since it doesn't normally keep track of the IDs.
The toc extension is really great. Could you add the de-duplicate functionality, if it is not too involved?
I'm not planning on it, but a pull request would be welcome.