Save a Markdown Link that Opens in iCab Mobile

Tweet This Post

On my I Miss My Mac blog, I offered a JavaScript bookmarklet that saves the current page in an iOS web browser as a markdown link and sends it to Drafts.

I have been using iCab mobile frequently, and often put markdown links in a text editor like Byword to use as a bookmark manager; here is an alternative bookmarklet/Drafts URL action that opens the markdown link in iCab.

javascript:window.location='drafts://x-callback-url/create?text=%5B'+encodeURIComponent(document.title)+'%5D('+encodeURIComponent(location.href)+')&action=texttool-icab';

(The semi-colon at the end seems to be necessary for iCab but not other iOS browsers -- feel free to experiment.)

Install the Bookmarklet

  1. In your iOS browser of choice, save any page as a bookmark and retitle it (e.g., "iCab-MD").

  2. Open Edit Bookmarks, tap on that bookmark, and replace the former URL with the javascript above.

Install the Drafts Action

The javascript tells Drafts to implement the texttool-icab action. Tap on this link while you're on your iOS device to install it. (You must own a copy of both Drafts and TextTool to make this action work. However, you don't have to set up TextTool to do anything.)

Here is the URL Action:

texttool://x-callback-url/transform?text=[[draft]]&method=replace&find=http&replace=web&x-success=byword:

How It Works

  1. The bookmarklet sends the page's title and URL in markdown link format to Drafts.

  2. Drafts sends the draft to TextTool, which replaces http with web (which is the URL scheme to open a web page in iCab).

  3. TextTool copies the results to the clipboard, then sends the user to Byword. (If you want it to send you to a different text editor, just add its URL scheme after the x-success= parameter.)


Last built: Tue, Mar 31, 2015 at 2:05 PM

By Jeffrey Kishner, Wednesday, December 11, 2013 at 1:31 PM.