Wikilinks auto-complete somewhat "prevents" the creation of links to headings + alias

… if the alias is already present in YAML/Properties of the file I’m trying to link to.

Apparently, if the alias I want to use to display the wikilink I’m creating to a file’s heading already exists in the YAML/Properties of said file, the wikilink auto-complete completely overwrite the currently selected heading and replace it by the alias instead of simply appending the alias after the heading in the wikilink.

It works as expected if I use a “brand new” alias (i.e.: an alias not added to the list of aliases in the other file as there’s no match found per the auto-complete)

(Sorry, it’s not easy to explain :sweat_smile: )


Steps to reproduce

  1. Create a brand new note in the Sandbox vault
  2. Add one or more aliases to a note in the Sandbox vault (e.g.: the aliases test, an alias, another test in Start Here.md)

→ Screenshot of Start Here.md in Live Preview :point_down:

YAML of Start Here.md in Source Mode :point_down:

---
aliases:
  - test
  - an alias
  - another test
---
  1. In the new note, try to create a link to the first heading in Start here.md (which would be the H2 titled as I’m interested in Obsidian) while wanting to display that link using the alias test

    [[Start Here#I’m interested in Obsidian|test]]

(See down below for the results I get)


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

Yes, this was tested in the Sandbox vault.


Expected result

The wikilink auto-complete shouldn’t replace the heading I selected by the alias but it should append it :blush: .


Actual result

After selecting the heading in the suggestions made by the auto-complete and inserting it in the wikilink using ⇥ Tab , I add a pipe (|) and try to select the alias I want to add to the wikilink (using once again ⇥ Tab ) … But, the previously selected heading is entirely replaced by the alias… which shouldn’t happen.

At least, I don’t really remember having such issues while trying to create a link such as : [[File Name#Heading|Alias]] before… but I could be wrong :innocent: .

Wikilink - Heading & Alias

On the other hand, if nothing can be selected as an alias in the auto-complete (the alias is not in the list of aliases and the auto-complete states no match found), it works as expected …

E.g.: creating a link to [[Start Here#I’m interested in Obsidian|Something]] where the alias “Something” is not in the list of aliases in the YAML/Properties of Start Here.md.

Wikiling - Heading & Alias 2


Environment

MacOS: Big Sur 11.7.9

SYSTEM INFO:
	Obsidian version: v1.4.2
	Installer version: v1.3.7
	Operating system: Darwin Kernel Version 20.6.0: Thu Jul  6 22:12:47 PDT 2023; root:xnu-7195.141.49.702.12~1/RELEASE_X86_64 20.6.0
	Login status: logged in
	Catalyst license: supporter
	Insider build toggle: on
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 0
	Plugins enabled: 0

RECOMMENDATIONS:
	none


Additional information

Fortunately, there’s a workaround to this :blush:.

When wanting to create a wikilink to a specific heading while displaying an alias (if the alias is already in the aliases key in YAML/Properties) one can add the desired alias first and then get back just before the pipe (|) to finally add the heading through the auto-complete but that’s quite unintuitive and not very practical as such links are written as [[File Name#Heading|Alias]].

Wikilink  - Heading & Alias Workaround

At least, when it comes to create such link into a note.

2 Likes

My favourite waste of time. :wink:

1 Like

thanks

1 Like

I sympathise :sweat_smile: !


My pleasure !

was fixed in 1.4.3

1 Like

I can confirm :grin: !

Thank you very much for fixing this :raised_hands: :pray: !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.