Autocomplete takes _all_ the text when linking to a heading that also includes a link with a display name/alias

Steps to reproduce

Create a note with a heading that links to another note, and uses a display name/alias for that other note. For instance, in my Test 1.md note I have:

### Test heading [[Obscure Note Title|with a link]]
Text under the H3 heading.

Then reference this heading within a separate note (in my case Test 2.md), and let the autocomplete create the reference. For instance, I typed the keys [[Test1# and then pressed enter.

Expected result

I expect the reference to the heading to use either the note title Obscure Note Title or the alias text with a link, but not both.

To be explicit, I would have epected to see either of the following:

  • [[Test 1#Test heading Obscure Note Title]]
  • [[Test 1#Test heading with a link]]

Actual result

Instead, the autocomplete reference inserts the following link:
[[Test 1#Test heading Obscure Note Title with a link]]

Funnily enough, when I manually type any of these options, they all seem to successfully link to the heading. It just is hard to interpret the raw markdown of the linked heading when it contains both the internal link and the alias of the internal link.

I have custom CSS turned off for this, and I have selected ‘shortest path possible’ for the links (I know this is a different thing, but the logic about being economical with link text is similar).

Environment

  • Operating system: macOS 10.15.6
  • Obsidian version: v0.8.1

Additional information

Sorry if this is duplicated, but I couldn’t find this elsewhere. At first I thought this might be the same as Linked mentions renders [[linked notes incorrectly]], but after closer looking I reckon they are probably different.

1 Like

Thanks, at some point we will overhaul how we treat header links.