Sometimes after writing, a user may want to go back and add an alias and the process can a little inefficient. They could type out the wikilnk syntax with [[ and then remove the ]] automatically generated and then add the alias. While a solution is possible with Templater as described below, I think this is a feature that at least a good amount of users would use, and its good to reduce dependency on 3rd party plugin.
Proposed solution
Create a command called something like “Create a wikilink” that replaces text with [[|text]] and puts the cursor between [[ and | so the user can type in . The command could be assigned a hotkey.
Current workaround (optional)
You could create a Templater template and assign a hotkey to it: [[<%tp.file.cursor() %>|<% tp.file.selection() %>]]
I don’t know what I do wrong, but it doesn’t work.
After inserting the template, I get: [[<% tp.file.cursor() %>|my_selection_text]]
So tp.file.cursor() is not being replaced.
Using the latest versions of Obsidian and Templater.
Well, it’s kind of odd that such a function was not implemented from the start. It is even among the base functionality of every visual editor since like the beginning of time:
Whenever you need to insert a link, you first 1) select some text and then 2) paste the link.
That’s it!
In Obsidian we just select our own text to create links to our own notes. So we don’t need to paste links probably, rather - we’d want to have notes looked up in our vault. And Obsidian has a tool for that already.
Imagine I have a dictionary of terms in my vault, and I mark incoming texts with the dictionary words: for each entry of a dictionary word I make a link to the corresponding note. And, of course, one doesn’t simply edit the original text apart from inserting links.
You guys should look at it and see if you have the issue too. If you do, I’d recommend replying to the thread saying you notice the same thing, and or at least give that post a thumbs up.
I have some text already written, and I want to select a word and then make it a link. Instead of a simple link, I want the link to have an alias, which would be the word that I have selected.
Have a look at Link with alias plugin, which is available since today. I made it exactly for the purpose and it helped me to create about 1700 links during 3 days of conversion of plain text to kind of personal wikipedia. I hope it helps you too
I would also really like to see this feature added. Useful for when reviewing over old notes and realizing there are some good link opportunities that exist now which didn’t back then.
+1 as well. I have the issue that I paste in quotes and within the quote I want to link to existing notes. Right now I have to manually enter square braces around the word / phrase and it’s really tedious.
I think I’ll put together a KM shortcut for this in the meantime
+1 to this. I was just complaining about the lack of this feature. The behavior when you choose the “internal link” command when text is selected is really unintuitive and unhelpful.
I think the default assumption of a pipeless link is reasonable, but piped links should be easier. Maybe always pop up the autocomplete form (if you want the link to just be the text it’s easy to select) but add a switch to select which kind of link?
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.