Links to Subheaders With Same Name Don't Resolve Correctly

Did you follow the troubleshooting guide? [Y/N]

Yes, and I did this in a sandbox.

Discovery Background

  • I have files where I’ll embed certain headers of other files. One of which is in a Q&A format on different topics, and I simply label each question sequentially under each topic. In Obsidian, I used the full path to embed what I want (first example in screenshot).
  • I use Quartz as a static site generator. It could not resolve the full path with more than one step, but if I shortened it to the lowest heading, it would embed it on the site.
  • I was using the Broken Links plugin and noticed it considered references to headers a few levels deep as broken, but if I removed the higher level headers, it was considered fixed.

Steps to reproduce

  • I tried to “fix” these broken links by manually selecting the lower level heading.

Expected result

  • I’d expect that full paths would be considered links (but I don’t know if that issue comes from the plugins themselves or how they’re interpreting Obsidian).
  • I’d expect that if I chose to select a specific lower level heading without going through all of the upper level headings, it would be able to reference/embed the correct one.

Actual result

  • A side by side of the Test file with headers and a second file I’m trying to embed header references into.
  • If you directly reference a lower level heading, Obsidian will always reference the first heading called that in the file.

Environment

SYSTEM INFO:
Obsidian version: v1.7.4
Installer version: v1.6.5
Operating system: Windows 11 Pro 10.0.22631
Login status: logged in
Language: en
Catalyst license: none
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none

+1

It’s surprising that something so beautifully-maintained as Obsidian is living with such a basic bug.

This causes the following bug in the plugin: Automatic Table of Contents

  • The links to headings don’t target the right heading if there are multiple instances of the same heading on the page (github [dot] com/johansatge/obsidian-automatic-table-of-contents/issues/57)