TECHNOLOGY NOTES

Find Me

Search

Getting Calepin to Work For Me

I recently saw a mention of a service called Calepin.co on Twitter and decided to take a look. The gist is that you can write markdown documents, put them into a specific directory on Dropbox, hit the Publish button and the Calepin service will take the markdown documents and publish them as a blog-based website.

The site actually bills itself as “the easiest way to self-publish online.” but that presupposes a technical leaning and a more-than-passing familiarity with markdown. If you do know markdown (and use Dropbox), its a pretty nice little blogging engine.

I’ve been playing around with the site for a while now but couldn’t create an easy workflow to get me to use it regularly. Since I’d love access to a private blogging engine to post things that aren’t necessarily technology-related, I decided to put some brainpower into figuring out how to make Calepin work for me.

//

The key ingredients happened to be KeyboardMaestro, Hazel and Byword.

First, I created a macro in KeyboardMaestro that opens up a Byword document with the pre-defined Calepin header. In KeyboardMaestro, the Calepin header block looks like this:

Date: %ICUDateTime%yyyy-MM-dd%
Title: 
Status: draft
Abstract:

The format has to be very specific in order for Calepin’s publishing function to work properly. Getting that figured out took a little trial-and-error but once I had it down, creating the macro made it easy and I no longer had to remember what the header needed to look like.

The Date line depicted above is in the format that Calepin requires. The code above is KeyboardMaestro-ese for “2012-02-21”.

Title can be any text.

Status represents whether or not you want the document published when put in the target directory. I set the Status line to “draft” when editing in case I submit the file in error, however, once I have the post written, I delete this line.

Abstract is a slug line but I generally just use the first paragraph of the post.

//

Once the post is complete, I need to get the file to the right directory. This part is pretty specific to my workflow so let me explain.

All of the documents I write throughout the day are in markdown format. They are saved as text files with my usual naming scheme and then stored in a single directory so they can be indexed easily by nvALT.

Since Calepin requires them to be in a different directory and suffixed with .md, I needed to get them there and rename them or risk breaking my workflow. Breaking the workflow required far to much work so I turned to Hazel to solve my automation problems.

I created a Hazel rule that looks at my default Dropbox/nvALT directory (“/Elements”) and checks to see if a file exists with the .txt extension and whose contents contain a few of the key header elements described above (“Date:”, “Title:”). If it does, Hazel copies that file to the directory that Calepin looks in to do its publishing.

Then I set up a second rule that looks for any .txt files hitting Calepin and renames them with an .md extension.

Once the file is safely on the other shore, the boats are burned and there is no going back – well, not easily anyway. Sure, I can navigate to the .md file and open it in BBEdit and change it, but the Calepin blogging “engine” (for me) is there for me to dump out ideas and put them on the internet. It seems to work pretty well and the steps outlined above take a lot of the legwork out of it.

This whole thing is kludgey and brute force, but I like that it uses some interesting interaction to accomplish some unique tasks and, hey, it beats writing a quick-and-dirty blogging engine myself, right?