I have a similar idea to this post Pasting of URLs, I don't know what exactly the author wanted to do there though. Anyway, I want to change the behavior of pasting or write a a plugin that converts file URLs like file:///home/user/Documents/document.pdf to markdown links like [document.pdf](file:///home/user/Documents/document.pdf), and also converts spaces to %20. It should automatically detect multiple URLs and convert them correctly as well as not convert the other words. In case of images, it should also convert them accordingly, so file:///image.png into ![image.png](file:///image.png).
Regex for Linux and Mac OSX would be sth like file://(/(\w+ +)+)+ and for images \.(png|tiff|jpeg|jpg), and for Windows backslashes instead of slashes and obligatory extension at the end.
The motivation is that when I copy files in Dolphin it automatically creates the URLs so it's convenient for me to paste them in Joplin and organize my files this way.
Is it better for the core code or a plugin? Pasting as text would stay the same.
I just think it should be a core functionality, like HTTP URLS should also be converted automatically. I don't know what other users think though. Typora doesn't do it either for example.
Also, if the plugin is the preferred option, then should it be the part of Paste Special or a new plugin?
Browser extensions like Copy as Markdown can alleviate conversion needs on desktop, but not as much on mobile.
Adding auto conversion to core, like how pasting works on Github, would expedite pasting URLs into the Markdown editor. Mobile would benefit more with its limited plugin capabilities. Do any mobile Markdown editors have this feature?
I'd like to see feedback on adding this feature to core from those preferring bare links or only using Rich Text. How discoverable and usable would they (and other affected groups) find the Paste as plain text keyboard shortcut or menu item?
I think it's quite discoverable considering the fact that it's a very common feature in most desktop applications of that type, like Thunderbird or Google Docs/Sheets for example.
Also considering the fact that it's a standard keyboard shortcut to paste as text.
Also, if somebody pastes the URL to the editor, in 99% of cases they want to create a link.
Now it struck me actually: if sb pastes it to the code brackets or inside code backticks, probably they don't want to convert it. Is there a way in Joplin to detect if the paste happens inside of code formatted area?
agreed in general, especially for the file protocol, but how about the application-specific protocols? I think in mobile it works like for example Spotify has its own link and it's not a http, it opens the Spotify automatically. Maybe on mobile Joplin could extract the playlist name automatically using Spotify API for example and use it as the link title.
Thanks for pointing it out, I think the same thing should be added to the core including other protocols as well, ftp, http(s).
This feature request shows how Evernote displays web links as previews in notes. Seems like there's some overlap in wanting pasted hyperlinks to show the page title.
What I found most interesting is how an excerpt of the link's meta description also displays. This could help users preserve more data and context beyond the title, especially if a page title is not informative enough.
+1 i wrote a batch file specifically for this and action it from the run window, so would be very interested to see if someone develops this idea further
Thanks for working on this @banan314 ! I hope it gets implemented into Joplin core soon as it is a much used feature.
I currently get by with copying the title of the website, pasting it and highlighting it, then copying the URL and pasting it using Ctrl+K. This is something I find very tedious everytime I had to do it.