1

When I copy a file path from the Windows file explorer and paste it into VSCode, it looks like that:

\\network_name\project\file 1.txt

For the link to be clickable and point to the right location, I figured that I needed to make 3 modifications: change the backslashes to forward ones, add "file:" at the beginning of the link, and replace spaces by "%20" (yes, my colleagues put spaces in file names everywhere, I can't do anything about that). The working link is the following:

file://network_name/project/file%201.txt

I want to be able to change all file paths from the pasted version to the working version at once in the open Markdown document in VSCode. How can I achieve that? It seems that this is the job for an extension, but I can't find one that does it.

Ben
  • 429
  • 4
  • 11

1 Answers1

1

You can use relative links like explained in next solution https://stackoverflow.com/a/59226851/1654688

Also, to use absolute path, this works for me:

[Folder](<file:///C:/Users/username/folder/filename.md>)

Note that including the path inside <> is intended to allow using spaces in the path or filename

gavioto
  • 1,695
  • 2
  • 17
  • 38
  • The trick to allow spaces is helpful, thanks. I'm not sure the rest answers my question. I understand what links work and do not work in VS Code Markdown. What I would like to have is a way to automatically transform non-working links (as copied and pasted from the Windows File Explorer) to working ones. – Ben Feb 15 '23 at 21:21
  • I'm also finding a solution to this. Probably an available extension could do the job, but I don't like to install 3th party extensions from un-trusted sources yet... – gavioto Jun 16 '23 at 22:23