Autosuggestion Broken: Referencing same heading-names from one document

Steps to reproduce

  • create a document
  • create two main headings and for each a subheading
  • give the subheadings the same name
  • in a different document reference to each subeheading (in the dropdown search menu, you see both subheading below the main heading)

Expected result

  • the subheadings should be each referenced respectively

Actual result

  • only one subheading gets referenced
  • despite choosing the second heading, the former gets displayed (probably because its recognized just by the name)

Environment

  • Operating system: MacOS Catalina
  • Obsidian version: 8.0

Additional information

  • It is easy to give the subheadings it’s own unique name, so the problem isn’t that serious
  • In my case I have facts about medical symptoms for different structures, that I want to reference in a summary page. Because each structure has “pain symptoms” the subheading pain is used frequently :wink:

This should work, however I now see that the autosuggestion doesn’t provide the right suggestion for this case.

If you have a file

# a
## aa
# b
## aa

[[file#a#aa]] will link to the first
[[file#b#aa]] will link to the second

Thats nice to know!
Would be great if the autosuggestion make this automatically. :slight_smile:

1 Like

I think it’s reasonable for the behavior right now. The auto complete adds exactly what you select:

  • If it added every parent heading, you might end up with a very long link, despite times that the subheading is enough.
  • If it only does that if the subheading isn’t unique, then which parent heading(s) should it add? Just the direct parent? Or just the top-most grand-parent? Or every single parent heading?
  • What if you create a duplicate subheading after making a link? Should we also smartly fix links to subheadings that were previously unique by adding some of the parent headings?

I think in this case, the system as it is right now allows for the user to control exactly what to add. As a user, just add the parent heading first if you know your subheading isn’t unique, or won’t be unique.

This is one of those situations where a user would make decisions based on their intention, that a “smart” system cannot guess. As such I’m more inclined to leave it as is right now and move this to bug graveyard.

1 Like

I think for the auto suggestion you can use the first level heading when there is ambiguity in the current file (Explanation in chat).

I agree on the second part. I would keep tracking of heading changes as a feature for the future.

I now realized, that it is possible to set a heading in the reference link and then still be able, with another ‘#’, to directly select all subheadings and so creating quickly a unique path if necessary.

This is the functionality I was looking for and I agree that right now it covers all the usecases.

Maybe it’s just me, but this functionality didn’t occurred to me, probably because Obsidian conveniently shows me all the headinglevels at once. Do you think it makes sense to add a hint for that in the documentation or somewhere?