Deep link ([[note_name#Header#Sub Header]]): broken completion

Steps to reproduce

Setup:

  1. Create a note “My note”.
  2. In this note, create a header with a link:
    # Header linking to [[My note]]
  3. Add a sub-header:
    ## Sub-header

Now, try to insert a link to the sub-header and use link completion (tab):
[[My note#Header linking to My note#...]]

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

Expected result

Arguably, we want to be able to use auto-completion and access the sub-header.

Actual result

When there is a link in an intervening header (“Header linking to [[…]]”), the auto-completion of subsequent sub-headers breaks (Obsidian does not display “Sub-header”).

Environment

Environment

SYSTEM INFO:
Operating system: ios 18.4.1 (Apple iPhone14,2)
Obsidian version: 1.8.10 (197)
API version: v1.8.10
Login status: not logged in
Language: en
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none

Hello.

Wouldn’t the syntax be either:

[[#Sub-Header]]

[[My Note#Sub-Header]]

Both of these have a correct syntax. In practice, they are generally ambiguous, though, because multiple sub-headers can have the same name, so these link forms don’t always work (case of a header entry that folllows a template). So it’s best to fully qualify sub-header paths (or you can get incorrect links).

I see. Perhaps this? :person_shrugging:t2:

You could then use a higher heading to specify the one you actually want, like in [[#heading c#heading a]] to get to the last appearance of “heading a”. You can’t use auto complete to find that though… And it does require for a somewhat proper heading structure in your document.

With 2 headings of same name in file can only link to first one - #3 by holroy

We can use auto-complete down to any sub-heading when there is no link in any intervening heading.

Being able to always do that would arguably be a useful bug fix!

Sounds more like a feature request than a bug report.

I really cannot say, but if this is a feature, it’s as useful as the existing auto-completion feature for sub-headers when no links are present in intervening headers (it does exactly the same thing, from a user point of view).

OK, it seems that I was a step behind. Sorry for the slow uptake. I thought it was a feature request to include sub-headers in autocompletion. I wasn’t aware that autocompletion already supported sub-headers.

So the bug report is about a special case of headings?

## Header plain text

### Sub-header

## Header with a [[wikilink]]

### Sub-header

Autocomplete works:
[[My note#header p…
[[My note#header plain text#…
[[My note#header with a …

Autocomplete does not work:
[[My note#header with a wikilink#…

You got it!!

1 Like