Joe Hewitt

The Glory of Plain Text

I am not ashamed at all to tell you this: I love text. I spend my whole day crafting very long strings of text, and I can't get enough.

Looking at my blog, you might not think that I like text very much, because I very rarely post any here. That's because, in order to post here, I have to use an editor that is not MY editor. To add insult, I have to log into a website and click several links before I can even get to this strange, foreign editor. If only I could post to my blog without this hassle, who knows, maybe I might post more often?

This evening, it occurred to that I already have the perfect blogging interface right under my nose. A couple hours and a few Python scripts later, I've glued it together. Before I explain how it works, let me give you some background....

While I am programming, I always keep a text file open in my editor. When I am stuck on a problem or exploring a new idea, I find that it clarifies my thoughts quite a bit to write freely about it. In the distant past, I would just fire up Notepad, jot my thoughts, and delete the file later. Last year it occurred to me that I should keep these files around. So, I wrote a script to open a new text file named for the current day in my editor, and run it when I hit the F1 key. Being only one keystroke away from my oasis of programming clarity proved to be quite addicting. I now have a mountain of text files chronicling a whole year of my coding adventures in great detail.

A few months ago I became quite interested in humane text formats. I started running my notes through Markdown and generating HTML files. While I didn't often look at the HTML files, it was good to get in the habit of using a consistent notation to add structure to my text.

So, it occurred to me today that my notes have pretty much turned into a blog that I compose using the editor that I know, love, and live in all day (BBEdit on Mac, Visual Studio on Windows). With the ability to convert humane text to HTML, all I would have to do is write a script to post the html to my blog using the XMLRPC API to Movable Type.

And so that's what I've done. To make it actually usable, I've used some of my favorite Mac glue (Quicksilver and AppleScript) so that I can open my daily blog file with F5, and post the file by hitting Option-S. I get some nice Growl notifications letting me know that things went ok. To make it fool-safe, I have to add the special tag [publish] to any post that I want y'all to see. After a new post is saved, its id is written to the header of the post so that subsequent postings will know which to change.

I won't go into much more detail now. If my theory holds up, then I might just post again soon. I think it might be fun to document some of my other personal workflow automations.