Enabling image copy-paste in markdown
In 2023, VS Code supports copying and pasting images directly into Markdown files starting from Stable v1.79.
Upgrade VS Code
To use this feature, ensure your VS Code is updated. Use the following commands to upgrade on Ubuntu:
sudo add-apt-repository -y "deb https://packages.microsoft.com/repos/vscode stable main"
sudo apt update
sudo apt -y install code
Configure Settings
Add the following configuration to your .vscode/settings.json
file to enable this feature and customize file destinations:
{
// Enable pasting files into the Markdown editor to create Markdown links.
"markdown.editor.filePaste.copyIntoWorkspace": "mediaFiles",
// Define destination folders for pasted files.
"markdown.copyFiles.destination": {
"**/*": "../assets/img/${documentBaseName}/"
}
}
Now, when you paste an image into a Markdown file, it will automatically save to the specified directory and generate the corresponding Markdown link.
Enjoy Reading This Article?
Here are some more articles you might like to read next: