snosov1 / toc-org

toc-org is an Emacs utility to have an up-to-date table of contents in the org files without exporting (useful primarily for readme files on GitHub)
GNU General Public License v3.0
287 stars 29 forks source link

Duplicated section names lead to wrong hyperlinks #46

Closed dmgerman closed 6 years ago

dmgerman commented 6 years ago

first, thank you for building this tool. it is very helpful. I have a document with the following structure:

The TOC is created by default for up to level 2. The TOC looks good. The problem is that the TOC entry for labelA (part of Section 2) jumps to the first occurrence of labelA rather than the second.

snosov1 commented 6 years ago

Hey!

Do I understand it correctly that you're talking about the C-c C-o (org-open-at-point) functionality?

If yes, then it's, actually, not my fault =) That's how org navigation for works. The headings have the same name and org uses a simple text search to locate it - so it doesn't have a way to distinguish between the two and stops on the first one.

That said, org has some capabilities to differentiate by attaching different ids or something to the headings, but it looks kind of clunky and this package doesn't implement this logic.

So, in summary - simply try to use different names for your headings =)