Unexpected behaviour when entering pipe in link creation dialog

When creating a link by typing [[ followed by part of a title, user is offered three extra options, see image. When there is a hit (the partial title corresponding to an existing file), which is selected, typing # or ^ completes the title before adding ‘#’ or ‘^’ at its tail end, but typing | unexpectedly does not complete the title, but simply adds the ‘|’ to the partial title that was manually entered. It seems to me that all three actions should work the same way, completing the title and then adding ‘#’, ‘^’ or ‘|’.

Type [[ → start typing the note name → use the up/down arrow keys to highlight the note you want to link to → hit Tab to auto-complete the note name → then # for a header or ^ for a block → use the up/down arrow keys again to highlight a header/block → then a pipe | → type your display text → then finally Enter . :sweat_drops:

1 Like

This works, but when entering # or ^ the title is completed automatically, without the use of the tab key. This should, I think, work with | as well.

Do you mean that after entering the pipe, you want the text / title to be completed automatically? If so, that won’t work.

  • # searches for and links to a heading in the second document
  • ^ searches for and links to a word or phrase in the second document
  • | allows the user to change the text displayed on the screen in reading mode

So if I have a file called ideas, I could change the link to [[ideas|Creativity Blooms from Getting Lost]].

When viewed in reading mode, I would see Creativity Blooms from Getting Lost but the link would open ideas.

Apologies if I have misunderstood. :thinking:

This has been asked before. It is intentional. Otherwise you would not be able to easily enter an alias to a non-existing note.

The pop-up says to use # for a heading and ^ for a block. The help pages say to use both a #^ to link to a block.

Using the caret alone works. Using the hashtag and the caret also seems to work. But which one is right (or best) and why aren’t the pop-up and the help pages consistent?

I’m trying to understand the part about the alias to a non-existing note. Aliases, I think, are defined in the metadata of notes, but those would then obviously have to exist.

Supposing you mean entering a different display text for a link to a non-existing note, I fail to see the problem, too; the title of non-existing notes is autocompleted when I type ^, so why would this not work with |? I am probably overlooking something, in which case please point it out to me.

This is really its own question, but: the #^ is the full syntax. When you type only ^, it changes to #^.

1 Like

What you said is right, but the thread is about autofilling the first part of the note. Not after.

In your example, [ideas|Creativity Blooms from Getting Lost]] the thread is about if you type:

[[ide^ the link will autocomplete to [[ideas^]] and begin searching for ^ matches in “ideas”.

So for consistency, (according to the OP request) if you type [[ide| then it should first autoexpand to [[ideas|]] and then let the user begin typing a custom alias.

@VanderG WhiteNoise is pointing out that it would become difficult to add a custom display text for a non-existent link. Which is something that is possible.

But ultimately, it’s not possible to search a non-existent link for one of it’s headings or blocks. A non-existent note has no internal content to link to. So it makes sense that # and ^ prioritize autocompleting.

You’re right though. If you already have an existing non-existent link, it will autoexpand to match. If you’re typing a new non-existent link for the first time, it will not (cannot).

2 Likes

I had never noticed that. Thanks for the explanation. My error.

Thank you. I had misunderstood the OP’s question completely. Appreciate the explanation.