Autocomplete and display text for markdown links

Use case or problem

  • I prefer markdown links over wiki links
  • I want autocomplete on my markdown links
  • I want to change the display text of my markdown links

All this without moving the cursor and using the mouse, in order for it to be fast and efficient. Wiki links already support this with the [[ and | keys.

Proposed solution

Trigger the autocomplete prompt after writing the opening parenthesis of a markdown link. (i.e. after this part: [display text](). I manually type the ]( characters.

Obsidian already automatically inserts matching brackets [] and parenthesis ().

Optional: Use TAB to move from the display text to the parenthesis, like this:

  1. Write [home and see [home].
  2. Press TAB
  3. See [home]() with the cursor between the parenthesis, and a popup with autocomplete suggestions.

Optional 2: Autocomplete suggestions are based on the display text.

Current workaround (optional)

  1. Use [[ to trigger the autocomplete popup and insert a link.
  2. Press <- many times to go back to the display text, use backspace to delete.
  3. Write a new display text.
2 Likes

if it helps …

“If you have Wikilinks turned off in your settings, then when you type [[ to start a link, it will show the auto-complete, but then the link will be formatted as a Markdown link.”
from Starting a wiki link displays files to link to; why not starting a markdown link - #2 by rigmarole

and …

“FIX: Turn on “Use Standard Markdown Links” in Editor options and continue typing in wikilinks to grab link from suggestions; this should then automatically reformat links to standard md, once a link suggestion is selected”
from Which is better- WikiLinks or Markdown links?

1 Like

Thanks, I was aware of this trick.

However can’t easily edit the display text with this …

Hello

When linking to a specific heading in a note, the wikilink syntax works great - eg…

[[Main One to Ones#2024-02-23]]

and the UI is very helpful to allow me to select which heading I want to link to.

image

As I prefer to use markdown links (for future portability), the UI doesn’t seem to display the same helpful pop-up:

image

Is this a known issue? Are there plans to implement this?

Thanks for reading!

1 Like

Even if you have Settings > Files and links → Use [[Wikilinks]] disabled, you can still use the auto-suggester by typing [[ for suggestions → arrow to or type the partial note note → # or ^ → arrow to the heading/block → enter, and a proper Markdown link (spaces encoded as %20 if necessary) will be created.

You’ll need to go back and change the display text if it’s not to your liking, but that works.

2 Likes

Related:

Thanks @ariehen - it seems you need to hit # as soon as you identify the note in question before the cursor exists the note name. Going back after the link has been created in your note doesn’t then reveal the headings. But hitting hash for the first time works great. Live and learn etc.