Home / GitHub Page

Support for links to local file?


#1

Can Joplin support links to local files in the notes?

Here’s an article on the topic: http://kb.mozillazine.org/Links_to_local_pages_don’t_work

I am currently not having success in creating links to places in my local filesystem, let me know if there is some kind of trick to it.


#2

Not that I’m aware of. The real question is what local is supposed to mean.

e.g. if the note is synced to a Nextcloud server (or any type of server), people could define local as a file in the Nextcloud (server) webdav directory structure.
On the other hand others mights see a local file as a file on the client. However, this will most likely lead to issues since this file won’t be available on all clients.


#3

My question was in regard to the most ‘local’ kind of link - to files on a specific computer (actually a networked drive with one of those UNC paths in my particular use).

I acknowledge the obvious fact that a local link would not work on a different computer without access to the same local file system. Despite that, the feature would be of some utility IMHO. An unsuccessful attempt to follow a local link from a different local environment would be a case of user-error.

The concept of file links to the local cloud host is also a good one, but not what I am specifically after in this particular topic.


#4

Someone tried it recently and it seems it already works. Simply put the full path to the file as the url, without file://


#5

neat, thanks for the tip - it appears that the spaces in my path break this functionality, and enclosing within single or double quotes do not help. (This is the Windows client, BTW)


#6

Can you try to encode the space with %20?


#7

Replacing the spaces with ‘%20’ does make the display correct in Joplin, however the link does not function.


#8

Just tried on macOS with latest Joplin version and it doesn’t work either.
I get the message: Unsupported link or message: /absolute/path/to/file.pdf


#9

As far as I understand it, Joplin uses markdown-it to translate markdown into html. Markdown-it by itself allows only html links per default, see https://markdown-it.github.io/markdown-it/#MarkdownIt.prototype.validateLink

One can (as they suggest) overwrite the default behavior by

md.validateLink = function () { return true; }

thereby enabling all url types. Entering this line in MdToHtml.js (render function) will enable the file-link with the following syntax:

[test](file:///home/user/test.pdf)

Instead of allowing all types of url one can use an altered version of the markdown-it original function: