Use text replacement to make easy file links possible

One of the main gaps in obsidian for me is the clumsy way to generate links to files outside the vault. The full path needs to be specified. This is cumbersome and fails when using it between different OS.

Wiki software had interwiki links (https://en.wikipedia.org/wiki/Interwiki_links) that essentially allowed you to search or link to a different wiki conform the syntax for that specific wiki. I think something like that would also work for linking to files.

Lets call them mdlinks that you have to define in the configuration. For me (I am on a Mac) I would create a mdlink called mydoc that is a shortcut to “/users/username/Documents”. I can then link to file:///md/test.pdf for example to open a test.pdf that is in my documents folder.

When I change OS to Windows I also have a mydoc mdlink and it is pointing to “c:/documents and settings/username/my documents” (I haven’t used Windows in 6 years or so so it might be the wrong folder, but you get where I am going with this). So with only changing 1 configuration setting I made all file links in my vault work on Windows which uses a different file structure.

You could even create multiple mdlinks to point to multiple ‘starting points’ in your file structure.

This would greatly improve linking to files and also facilitates moving from one OS to another. Most of the time the structure of the files stay the same. You could also create mdlinks for shared drives or sync drives like Box or Dropbox when using it from multiple computers.

The text replacements needs only to be done when opening a link. And maybe when if you want autocomplete for files in a mdlinks location when doing the linking, including subfolders ect.

Let me know what you think.

Regards,
JeRoen

2 Likes