Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

Incorrect Jumping for Table of Contents Titles

Open noahmillar opened this issue 4 months ago • 4 comments

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

  1. Create a markdown file with 2 headers that are the same.
  2. Click on the second header in the table of contents page.
  3. 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

noahmillar avatar Jul 08 '26 15:07 noahmillar

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.

PathGao avatar Jul 24 '26 20:07 PathGao

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.

PathGao avatar Jul 31 '26 06:07 PathGao

It now works for the preview, but it still jumps to the first heading in the text editor!

noahmillar avatar Jul 31 '26 20:07 noahmillar

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.

PathGao avatar Aug 01 '26 02:08 PathGao