Using Keyboard Maestro to drive Marked 2

My writing tools are varied based on where/how I'm writing - laptop vs iPad vs iPhone. But the final review process almost always ends up on my Mac in Marked 2. Marked 2 is a peculiarly wonderful app in that it doesn't directly create anything. Marked 2 is just for viewing Markdown text files.2 So when I view my content in Marked 2, I can see the content using the same CSS styling as I use on my site.

Normally when I run Marked 2, I will open a folder from Dropbox that holds all of my Markdown (MD) notes. Marked 2 has the ability to open a folder and then change what document it being previewed based on what file has had the most recent revision. This makes my writing time so much more effective because I can make changes to one post, updates notes in another file, come back to a 3rd document - and I don't have to change anything in Marked 2.

Brett Terpstra (@ttscoff), the creator of Marked 2 wrote in a recent blog post about using URL handlers in Marked 2. I looked a while back on using the URL handlers1 and the format is pretty simply. Basically you can open a MD file in Marked 2 from either a link or from Terminal command. For example:

open -g 'x-marked://open?'

The problem I had with the URL handlers in the past was the it required an actual filename. I don't always know the full file name when I open Marked 2 because I want it to open my MD folder, not a specific file. What I wanted out of the URL handler was something equivalent to this:

open -g 'x-marked://open?file=~/Dropbox/MDFolder&raise=true'

Since Marked 2 didn't have the option to open a folder, I looked at creating a macro in Keyboard Maestro. The goal was to create a keyboard short cut to open Marked 2 and have it open my normal MD file folder.

With this macro, Marked 2 is opened and then will open my MD file folder.

  1. Or x-callback-url for iOS reference. 

  2. Brett got a Marked 2 revision kicked back because the Apple reviewer couldn't create a file. RTFM... ;-)