Type | while text is selected to create a link with the selected text as an alias

I don’t see why that’s necessary. Either the selected text already matches the title of an existing note, in which case no further action is needed, or it doesn’t, in which case you want a popup to find a note to link, and a pipe.

I would love the ability to automatically create piped links (internal links with alternate display text, e.g. [[link|link text]]).

This is how I imagine it: Highlight a line of text and then (by means of a keyboard short cut which opens the internal link selection interface) insert an internal link on top of it. The result would automatically place the highlighted text after the pipe (“|”), and the name of the note linked to before it.

This way one could easily integrate internal links into existing text without the usual fenagle.

4 Likes

This would be just great for my workflow.

So, +1!

2 Likes

Duplicate of Ability to select text and convert it into an internal link

1 Like

When we press [[ the autocomplete is triggered and shows by default the most recently created or edited notes. As we start typing, the autocomplete options matching the typed text appear. If we choose one of them, the name of the note and the closing “]]” are placed automatically. Now if we want to insert | at the proper place (i.e. just before the double closing brackets and just after the linked note name) we need to shift the cursor MANUALLY two places left as the closing brackets are already placed by the autocomplete. And then we can paste whatever text we had cut before all this endeavor to make it the link text. This is not at all automatic.
Please view my solution in the reply to the original query above.

We have ESPANSO, a free text expansion app for windows, to our rescue.
Please follow the steps below…

  1. Install espanso on your pc (windows)
  2. Go to the espanso match folder which is generally C:\Users\user\AppData\Roaming\espanso\match in the windows. Please replace the appropriate “user” name in your pc.
  3. Here you can find a yml file named ‘base’
  4. Open it in any text editor (notepad is ok)
  5. add the following replacement code after the “matches:” line.
  - trigger: "\x0C"
    replace: " [[$|$|{{clipb}}]]"
    vars:
      - name: "clipb"
        type: "clipboard"

Here x0C represents the ascii code for the key combo ctrl+L (I use this keyboard shortcut in the Obsidian to insert internal note link)
You can find the ascii table for other key combos here.

  1. Go to a note in Obsidian. Select some text you want to become the link text. Hit ctrl+x to cut the text.
  2. Now hit the ctrl+L combo. That creates a link structure with our link text inserted and the cursor is placed automatically just before the | character. e.g.
[[cursor|example_link_text]]
  1. We can now see that the autocomplete window appears on the screen showing the most recent notes to be inserted. But we can start typing and the search results are refined accordingly. Go ahead and choose a note link by pressing Enter.
  2. That’s all.
  3. We can use autohotkey script to make the selected text cut and mounted to the clipboard as well. But I find simply cutting the selected text with the familiar ctrl+x more convenient and handy.