Paste Markdown Link 
A simple VS Code extension that helps you create formatted Markdown links quickly. When you have text selected and paste a URL, it automatically formats it as a Markdown link [TEXT] (URL).
NOTE: VS Code now has built-in support for pasting a URL to automatically create a Markdown link (markdown.editor.pasteUrlAsFormattedLink.enabled), and the feature is on (smartWithSelection) by default. However, this extension provides stricter and smarter checks for URL validity and Markdown link syntax, and has support for many URL protocols and Markdown image links.
Usage
- Select some text in a Markdown file [1]
- Copy a URL link (e.g.,
https://www.example.com [2]) to your clipboard
- Press Ctrl + V (Windows, Linux) or Cmd + V (macOS)
- The selected text will be converted into a Markdown link
[TEXT] (URL) with the URL
Advanced Usage
Three commands are available:
- Paste Markdown Link (Ctrl+V): The basic command described above. It checks if the clipboard text is a URL with known protocols [2] and pastes it as a Markdown link
[TEXT] (URL). Default keybinding: Ctrl + V (Windows, Linux) or Cmd + V (macOS)
- Paste Markdown Link: Same as above, but is "forced", meaning it does not check if the clipboard text is a URL, and pastes the markdown syntax no matter what is selected.[3] Typically used to paste relative links like
[TEXT] (/path/to/file). No default keybinding.
- Paste Markdown Image: Same as above ("forced" (no clipboard URL check and no selection check)), but pastes an image link
![TEXT] (URL). No default keybinding.
Press Ctrl + Shift + P to open the command palette, then search for these commands and press Enter.
Notes
- [1]: Markdown, MDX, R Markdown, and Quarto files are supported
- [2]: Typically
http(s) links, but also supports: ftp(s), file, sftp, ssh, scp, mailto, tel, sms, callto, magnet, torrent, ed2k, thunder, dchub, dcpp, irc, ircs, news, nntp, git, svn, hg, data, blob, ipfs, ipns, chrome, chrome-extension, about, resource, moz-extension, ws, wss, vscode, cursor
- [3]: If one selection is within an existing Markdown link or image, or one selection spans multiple lines, the "Ctrl+V" command will replace the selection with the clipboard text as-is without adding Markdown link syntax, but the other two commands will add the Markdown link syntax (newlines will be replaced with spaces)
- When no text is selected, two non "Ctrl+V" commands create a markdown link with empty brackets with cursor inside
- All three commands support multi-selection. Each selection is processed independently, as if it were a single selection
- Compatible with VS Code 1.75.0 or higher and its derivatives like Cursor
- This extension is not needed if you're using Markdown All in One, which already includes this feature. Paste Markdown Link is intended as a lightweight alternative for users who don't need the additional functionality provided by Markdown All in One
- No user settings are available
- No runtime (bundled, non-dev) dependencies. It's minimalistic yet includes tests and a CI build pipeline targeting both the Visual Studio Marketplace and the Open VSX Registry. It can serve as a template for other extensions
- MIT License
Release Notes
1.0.2
1.0.3
- Add support for multi-selection
- If a selection is inside an existing Markdown link/image or spans multiple lines, the clipboard text is pasted as-is without Markdown syntax
1.0.4
- When no text is selected, the two non "Ctrl+V" commands create a markdown link with empty brackets with cursor inside
1.0.5
- Change command names
- If a selection is inside an existing Markdown link/image or spans multiple lines: the two non "Ctrl+V" commands will add the Markdown link syntax (newlines will be replaced with spaces)
- Fix multi-selection (in document order and not) cursor placement issue
1.0.6
- Fix nested markdown link/image detection issue
1.1.0
- Fix cases when markdown image is selected
- No need to install separately for WSL (added
extensionKind: ["ui", "workspace"])
1.2.0
- Detect markdown links/images with balanced parentheses in URLs (e.g.
[wiki] (https://en.wikipedia.org/wiki/Foo_(bar)))
- Detect reference-style markdown links/images (
[text][id], ![img][ref], [text][])
- Ignore markdown link syntax inside inline code spans (backticks)
- Fix same-line multi-selection cursor positioning
- Fix keybinding language ID regex for MDX
| |