Use case or problem
The builtin command “insert markdown link” (Ctrl-K) allows to add the markdown syntax for adding a link to selected text, which is very useful.
For instance, if you select the word “text”, and then press Ctrl-K, you get
[text]()
and the cursor is placed inside the braces so that you add or paste a hyperlink.
Sometimes however, you have the opposite problem, you already have a hyperlink and want to add text to it. As far as I see, there is currently no command for this, and the existing Ctrl-K hotkey does not work very well for this case.
For instance, if you select the link https://obsidian.md and then press Ctrl-K, you get
[https://obsidian.md]()
This is usually not what you want. Instead, you probably want this
[](https://obsidian.md)
and the cursor be placed inside the brackets so that you can enter a link text like “Obsidian homepage”.
Proposed solution
The “insert markdown link” command should check if the selected text is a hyperlink. In this case, it should put the hyperlink in braces and add add empty brackets, instead of the normal behavior.