Bookmarklet for adding Markdown Links to PlainText Lists
This is a follow-up to “How I Handle My RSS Queue On The Mac And iOS”. When I wrote the post I struggled to find a good solution for filing away RSS articles on the iPhone since no RSS reader offers support for a kind of advanced automation (aka x-callback-url support).
This post is about a bookmarklet which enables you to send an inline Markdown link to Launch Center Pro which prompts you to select one of your plain text lists and prepend or append the link.
Previously, I’d open the article in Safari and press my bookmarklet for saving an inline markdown link to my clipboard. Then I’d open up Drafts and send the link to one of my plain text lists. That might read like a few taps but it feels slow and tedious.
I love my list workflow on the Mac…
… but I really struggle with getting automation done on my iOS devices.1 Anyway, I managed to port my filing browser links workflow to TaskPaper. I now have a bookmarklet that I can fire up in Safari and end up with this:
What this does is it sends the URL as a Markdown Link to one of my Taskpaper lists formated like this:
- [Automating iOS: A Comprehensive Guide to URL Schemes and Drafts Actions](http://www.macstories.net/tutorials/guide-url-scheme-ios-drafts)
- [Share your clipboard among your devices with Command-C](http://philgr.com/blog/share-your-clipboard-among-your-devices-with-command-c)
- [SearchLink for Editorial](http://olemoritz.net/searchlink-for-editorial.html)
I struggled at some point, but iOS automation wizard Eric Pramono from Geeks With Juniors was kind enough to help me out on Twitter. Although I did my own research and Eric gave me a working example which closely resembled what I tried to accomplish, there where still some bolders in my way.
The code:
Here’s the end result:
Decoded view:
javascript:window.location='launchpro://?url='
encodeURIComponent('launch://dropbox/prepend?text=
- [ document.title]('location.href ')
&path=/Todo/&name=[list:TaskPaper Lists|Inbox|Today|iOS Automation|OS X Automation|OS X Organization|RocketINK|Web Development].taskpaper');
Basically you can copy everything until line 3 (and don’t forget to remove the line-breaks). Then customize the script and encode it the part you just edited.
Encoded view:
javascript:window.location='launchpro://?url='+encodeURIComponent('launch://dropbox/prepend?text=%2509-%2520%5B%7B%7B'+document.title+'%7D%7D%5D('+location.href+')%26path%3D%252FTodo%252F%26name%3D%5Blist%3ATaskPaper%20Lists%7CInbox%7CToday%7CiOS%20Automation%7COS%20X%20Automation%7COS%20X%20Organization%7CRocketINK%7CWeb%20Development%5D.taskpaper');
I struggled a bit since Launch Center Pro wouldn’t accept my list. The problem was that the URL title (more precisely the spaces in a title). I tried double and triple encoding it, but failed. Adding the URL encoder helper `` around the fetched document.title
and double-encode them proofed to be the solution.
Installation
To keep it simple, here’s an older YouTube video on how to install bookmarklets on iOS: http://youtu.be/BG9TXlJ5pts.
If you use iCloud to sync your bookmarks you can modify the code to your liking and copy it to a new bookmark.
Bonus
Bookmarklet for getting an inline Markdown link into Drafts:
javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent('%5B'+document.title+'%5D')+encodeURIComponent('('+location.href+')')
Bookmarklet for getting an inline Markdown link into Drafts and use the apps “Copy to Clipboard” action:
javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent('%5B'+document.title+'%5D')+encodeURIComponent('('+location.href+')')+'&action=Copy%20to%20Clipboard&afterSuccess=Delete'
Bookmarklet for getting an inline Markdown link into the clipboard via Launch Center Pro:
javascript:window.location='launchpro://?url='+encodeURIComponent('launch://clipboard?text=%5B%7B%7B'+document.title+'%7D%7D%5D('+location.href+')');
-
This is why rarely see a post about Pythonista or Editorial on this blog. I have some basic actions, but they are not what I envision or to buggy to post here. ↩