Incorrect Jumping for Table of Contents Titles
Describe the bug When there are two of the same title, pressing the title in the table of contents sidebar always takes you to the first instance of it.
To Reproduce
- Create a markdown file with 2 headers that are the same.
- Click on the second header in the table of contents page.
- You are taken to the first header instead.
Expected behavior Clicking on the second header should take me to the second header!
Device
- OS: Windows 11
- Version 25H2
- App Version v2.6.11
Merged PR #219 now promotes Comrak deduplicated heading ids onto the actual heading element. The ToC reads and jumps by that id, so duplicate headings should receive distinct ids such as title and title-1. Could someone retest the two-identical-heading reproduction on the latest release? If the second ToC entry now lands on the second heading, this issue can be closed.
Current master retains the #219 deduplicated heading-id path and has a regression test for heading-id promotion. Please retest with two identical headings on v2.6.14; if the second ToC item reaches the second heading, this issue can be closed.
It now works for the preview, but it still jumps to the first heading in the text editor!
Thanks — that isolated the remaining editor path. The preview uses the deduplicated heading id, but the editor was still searching by heading text from line 1. PR #335 now passes the selected preview heading’s source line to Monaco, so choosing the second identical ToC item selects the second heading. I verified the two-identical-heading case in edit mode with an isolated macOS release bundle. It is queued after the current PR chain.