(UPDATE Jan. 2017: A kind visitor recently let me know that the original workflow I created years ago, had stopped functioning properly. I’ve since fixed it and wrote a follow up post here).
A heads up: As the title implies, this post assumes (or, in a way, suggests) that you have purchased Scrivener, Marked and the Powerpack option in Alfred 2.
One of Scrivener’s shortcomings (yes, they do exist) as far as Markdown support is concerned, is its inability to give an HTML preview of your Markdown syntax while you write in it. There is no workflow for accomplishing this other than exporting your MD or MMD, opening it in another editor that reads MD (or the converted html) and checking it there before cutting and pasting the code into your blog’s editor.
In all fairness, that’s not what Scrivener was created to do and just because I’ve found some slightly unconventional uses for it, I can’t expect the good folks at Literature and Latte to change their software to accommodate lil ole me. We all know Scrivener is much, much bigger than blogging and writing in MD and MMD.
The good news is that even though Scrivener doesn’t have an in-app html preview function for your markdown, there is one program that you can use in tandem with it that can.
That Program is Marked.
You can read about Brett Terpstra’s “Marked” in a slew of different places (including its recommendation in the comments on this site ) so I won’t write a review of it here (maybe another time). In a nutshell though, Marked is a realtime markdown converter that works with any text editor you throw at it. Open a text file in its respective editor, open Marked, then drag the same file into Marked and go back to the text editor to continue writing/editing. As you save your markdown document, you’ll see it update in Marked, displaying the converted HTML instantly.
Cool right? It’s also a game-changer.
Integrating Marked has made my blogging workflow in Scrivener much more streamlined because of Marked’s handling of MD/MMD as well as its plethora of options and amazing tools for authors. But, that all said, getting a file into each application is clunky at best and almost immediately after doing that a couple of times, I wanted/needed to automate that initial step so that it was smoother.
Alfred is another popular tool out there whose sole function is to streamline everyday tasks like launching multiple apps at once, finding files quickly on your computer, searching the web, quitting apps, shutting down or restarting your computer… you get the idea. It does all of this from your keyboard and once you get used to its commands, you’ll get addicted to not touching a mouse or track pad. In truth, it’s one of the first apps I install when I get a new computer.
But aside from these baked-in options that you get for free, you can also pay for the Powerpack option and unlock a slew of very powerful tools that give you immense control over your Mac. One of these tools is the ability to easily create custom workflows. Once I encountered the dilemma above, I dove in and immediately came up with a solution.
Now, one caveat. I am not much of a programmer, so I made my workflow out of the built-in modules that Alfred gives you out of the box. I am sure that with some custom scripting this workflow could be made even nicer (if you have suggestions for improvements leave them in the comments below please). That all said, I was really happy with how this workflow came out. To save you (and I) some time I’ve included a link to the workflow below, so that you can download it and add it to your own personal workflows in Alfred. Just download it, double-click and add it to Alfred. Easy.
The way the workflow works is you bring up your Alfred prompt. Type in the keyword, which in my case is “scrivmarked”, that then allows you to browse your “Documents” directory right in Alfred. Once you find the .scriv file you want to open, arrow down to highlight it and hit the right arrow key where you’ll find a file action to open the file in both Scrivener and Marked, arrow down to that action and hit enter.
Make it Your Own
One of the best things about workflows In Alfred is that you can tweak them to suit your needs relatively easily. Hate my keyword? Choose a different one. Have your Scrivener project files in a different location outside of the Documents directory in OS X? No problem, tweak the search scope. These, and many other aspects of workflows, can be tweaked easily in Alfred without knowing a single line of code.
But, again, if you do know a way to make this better, I’d love it if you posted your modifications in the comments below! I am sure there are many ways to make this workflow even more useful to us all!