Home / GitHub Page

Support for links to local file?

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 Likes

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.

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.

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

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)

Can you try to encode the space with %20?

1 Like

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

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

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:

Hi there,
ok, with the current version (1.0.115) a link to a local file also doesnt work for me. No matter if I paste the path directly or use “file://”. I know that local links might limit the usefulness of a notebook, but I think there are many cases in which a file might need to get modified from the “outside”, in this case a local attachment isnt usable.
Would it be possible to enable “local file links” by default or add an option to enable this ? (Without hacking the local joplin-installation)

It doesn’t work with 1.0.116 either. I believe this was unintentionally removed when fixing another issue. You should open a github issue that references to local files do not work anymore.

I’ve opened an issue on github:

1 Like

Hey there,

I am new to Joplin (and note taking apps in general) and have just played around with this as well.
For me, on a mac, linking to local folders works with ‘file://’ in front of the link, as long as the link does not contain white spaces. Clicking the link then opens the folder in Finder.
Linking local files does not work for me.

Generally, should linking local files work? And, if not, how difficult would it be to include the functionality? (Something like right click: open with?)

For me, as a newbie to note taking, this seems like the most important feature of all, because I work as scientist, and code and plot and write latex notes, and now I want to link to these folders/files from within my notes. Importing everything would not work or make sense…
How do other people deal with issues like these?

In general it works yes, I frequently use local file links and I’ve never had any issues.

This seems to be an issue that is related to you. Can you send an example of a link that doesn’t work?

Hey CalebJohn,
when looking for the example, I found the problem: I had forgotten the ‘file://’… Now it works. So, thank you for the help :slight_smile:
Since you are using this: Is there a good way to deal with empty spaces in file/folder names? And, on a related note: Is it possible to link to other notes in Joplin?

1 Like

Hiya, TSeral, and welcome!

When you right-click a note, you will see ‘Copy Markdown link’. Just click that, then paste the link into a note.
image

Not sure about the spaces in file paths, since I don’t use them (I want to avoid including stuff that will break when I sync it to other devices), but have you tried enclosing the path in quotes? That often works.

Hey zblesk,

thank you for the help. I got both to work. When looking for links, I apparently only tried right-clicking notebooks, not actual notes, so I completely overlooked the existence of the ‘Copy Markdown Link’… Is it possible to give nice names for the links instead of the random identifiers?

I try not using spaces in file paths too, and definitely not for paths with data that I want to access with the bash, but sometimes I forget… Quotes did not work, but I got the link to work by replacing the space by ‘%20’.

Found the answer of how nice linking to other notes can be done. Get the identifier id via ‘Copy Markdown Link’ (right-click on note), and then define a nice name in the note where you want to use it via
[Nice Link Name]: id

[edited for understandability]

Since it is a URL, you have to URL encode all special characters in filenames (e.g.: ' " ! ~ $ % & and so on …).
However for spaces there’s a sweet shortcut: use + instead of %20. This should work too.

1 Like

I just tried the +, and it seems to work for me as well…