New Markdown tools to streamline and automate blogging with Elements, WriteRoom and Automator

Growing adoption of John Gruber's drafting language Markdown has been changing the way people write. In this post, I'll be sharing how I've simplified my writing work by adopting some of the new text editing tools that have become available in recent months. I'll also show how I've recently managed to streamline the rather complicated sequential process I had been using to draft my blog posts since 2007.

My current system looks like this. The various stages referred to in it are described in greater detail below:

Blogging process flowchart
Blogging process flowchart showing the much simplified structure I now use, bypassing TextMate altogether: on my Mac, just two applications are used, WriteRoom to draft the post, and MarsEdit to preview and publish it; on my iPhone or iPad, I use Elements to access any draft posts, which are all stored on a Dropbox folder. Though not shown on the chart for the sake of simplicity, images are hosted on Amazon Cloudfront rather than my own website to optimize distribution and ensure portability should I ever change my host.

I've been writing my blog posts using Markdown [i] for the past four years. In case you don't know about it already, Markdown is a huge time-saver for anyone posting to a website regularly. As Mr Gruber himself puts it on his website:

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

Thus, “Markdown” is two things: (1) a plain text formatting syntax; and (2) a software tool, written in Perl, that converts the plain text formatting to HTML.

Why is Markdown the quickest and cleanest tool for drafting anything you write that needs formatting?

The reason Markdown saves time is because instead of having to manually enter HTML code, which is very time-consuming, or rely on rich text WYSIWYG editors that produced bloated, non-compliant code, it allows you to draft a post using any text editor in a format designed to be as intuitive and natural as the format of an email. Once you've finished drafting, you can do one of two things depending on preference: either post your text in Markdown and rely on a plugin to convert it to HTML on the the fly [ii], or convert it using the Perl script and post the resulting HTML to your website.

Until now, I've been using Markdown in a slightly complicated way, involving the use of three different tools:

  • Hog Bay Software's WriteRoom to draft the post in a distraction-free environment filling my entire screen;
  • Macromates's TextMate, an amazingly powerful text editor for the Mac—that is, however beginning to show its age—to convert the Markdown post into standards-compliant HTML;
  • Red Sweater Software's MarsEdit to actually post my work to my blog.

Markdown is much quicker and more intuitive than HTML, especially for inserting links, a process that can be further automated using a text expanding utility: I use Brett Terpstra's TextExpander Tools to automatically create a link for any url I've put into my clipboard.

This is a combination that has served me well for years, but two recent developments have made me decide to change things:

  1. Markdown, which three years ago was effectively no more than a way of speeding up one's writing, is increasingly supported out of the box by desktop applications, iOS clients and even blogging platforms;
  2. whereas until this year, using anything other than a Mac was unrealistic for writing, iOS 4.x has made drafting posts on the iPad, and even the iPhone, a realistic proposition.

New applications have been flowing in to provide writers and bloggers with new means of taking advantage of these trends. It would be foolish not to take advantage of them, especially since the current version of iOS has finally enabled users to pair their mobile Apple devices with a bluetooth keyboard.

Elements for iPad and iPhone has just become massively better and now supports Markdown out of the box

I've already blogged about Elements, a new Dropbox-enabled, universal (iPhone and iPad) iOS text editor. It already had more features than any other mobile text editor, but has just become massively better:

  • it now supports subfolders: I use this to store both short notes and draft documents, meaning I can keep a distinction between them while accessing them via the same text editor when I'm on the move; this effectively means I can now dispense with Simplenote on my mobile devices;
  • both versions of Elements support Markdown documents (effectively, text files saved with extension .md instead of .txt).

Although Elements doesn't yet handle converting Markdown files to HTML, its companion universal app, appropriately called Markdown, does. My only reservation about this is that while I find the combination of a very well designed text editor and of a Markdown conversion tool compelling, I can't actually see the point of offering them as distinct apps: I've pleaded the case for a merger with Second Gear, the editors of the two apps, and they told me they were looking at it. As things stand at present, however, if you want to edit and preview natively in Markdown and export from it, you have to buy both apps. One added bonus of the Markdown iOS app is that if your blogging platform supports posting in Markdown by email (which Tumblr and Posterous both do out of the box), you can actually put your posts online. WordPress hosted blogs can be set up to do this as well, although HTML tags will be stripped out, tags can't be set and automating publication after you've sent the post in is convoluted to say the least [iii].

WordPress for iOS, which was buggy when first launched, now seems to be a reliable way of posting simple, HTML-formatted posts to a WordPress blog from any iOS device. Essentially, if you want to draft blog articles in Markdown and post them in HTML entirely on an iPhone or iPad without compromising on code quality, you can now do so using a combination of Elements for drafting, the Markdown app for conversion to HTML and the WordPress app for posting to your blog.

WriteRoom remains my choice of desktop text editor and has aged remarkably well, but its editor Hog Bay Software really needs to update it

I've been using WriteRoom, the pioneer minimalist text editor from Hog Bay Software, for three years, and have written before about how much I love it . As an earlier reviewer put it:

Green text on a blank, black screen, with a square, blinking cursor. This was how most of us wrote on a computer in the early 1980s, and it's resurfacing a quarter of a century later.

(Rob Pegoraro, Washington Post)

The green on black, back-to-basics screen was great on the Mac. But it was indispensable on an iPhone: no one even tried fitting in all the features of a fully fledged Microsoft Word-type word processor on the iPhone's tiny screen. To a lesser extent, the same held true of the iPad: Apple, which had a starting advantage in this field, shot itself it the foot by burdening Pages for the iPad, part of its mobile iWorks suite, to export its documents only via iTunes or by email, condemning it to obsolescence before it even began. By the end of this year, a battery of text editors for iOS have appeared: I've reviewed them here earlier, with my current favourite being Elements—whose most innovative feature, built-in Markdown integration, makes writing on mobile devices a much easier experience than with any other app.

Rather surprisingly, however, no one one has developed a companion app integrating Markdown for OS X. The established leader in this field remains the venerable TextMate: you can create and edit documents in Markdown and convert them to superbly-coded HTML at the click of a button (or even to MultiMarkdown, Fletcher Penney's derived, slightly more feature-rich version of the original Markdown). Unfortunately, though, TextMate hasn't been revised at all since February 2009; users have been waiting for three years for version 2, for which the developer announced in January that he had had no fixed release date and closed comments on the post one month later, raising fears that this fantastic, powerful yet lightweight application may be on the road to becoming abandonware.

WriteRoom also hasn't been updated much since it first launched four years ago. Of course, its innate simplicity means it doesn't really need much updating. Yet it would still benefit from the following two adjustments:

  • better Markdown integration: at present, it's easy to draft texts in Markdown, and save them, using the .txt extension; this is what I've been doing, copying and pasting the text into TextMate for conversion to HTML, and then to MarsEdit for posting to my blog; but it would be nice if you could preview and save drafts in Markdown format (with the .md extension) and, above all, export them in HTML format to speed up subsequent processing for people who, like me, only use Markdown for drafting them;
  • better character encoding: the current version of WriteRoom saves by default in Mac OS Roman; this is rather strange, since ever since the release of Mac OS X, Mac OS Roman and all other "scripts" (as the Mac OS called them) were replaced by UTF-8 as the standard character encoding for the Macintosh operating system, and documents saved in it cause numerous issues including being incompatible with other text editors such as TextEdit; there is a preview release 2.5 of WriteRoom that allows you to set another default for character encoding, but it would actually make more sense save all documents in Unicode UTF-8, which ensures compatibility with all other applications and most languages.

I very much hope Jesse Grosjean, WriteRoom's developer, will bring these two improvements to the next version of his application

MyTexts, a promising new text editor with versions for Mac OS x, iPad and iPhone is definitely a newcomer to watch; it's still buggy, though, and not nearly as polished as Elements on iOS

I was initially relatively excited about MyTexts, a set of minimalist-inspired text editors designed for three different platforms (OSX, iPad, iPhone) and manifestly inspired by WriteRoom. I've tried all three declensions for the past few days—but have decided not to use the desktop version—which, alone of the three, offers MarkDown conversion—as a replacement for WriteRoom. The developer of MyTexts, Michael Göbel, was responsive to my questions about MyTexts (which was featured as a staff pick by Apple), and I'm certain he will be working to improve the application over time. The desktop app boasts, among others, the following features:

  • iDisk and Dropbox Support, meaning that you can set MyTexts to store texts, in its own proprietary format, in its own dedicated sandbox folder on Dropbox or iDisk; alternatively, you can store them ;
  • snapshots, backups, auto-save and snippets;
  • Markdown preview;
  • export to PDF, Word, open Office, Text and HTML format.

The application is promising, very thoughtfully and elegantly designed, but MyTexts stores all documents in a proprietary format (you can still open them in another text editor, but they will then be cluttered with metadata, rendering them useless in that format), and I'm really at a loss to understand why a minimalist text editor doesn't at the very least offer its users the option to store their documents by default in text format, and perhaps in Markdown as well: the proprietary MyTexts format is useless to me, and forced me to 'export' my texts to text format every time I wanted to simply save them (MyTexts, again, autosaves in the background to your chosen location, but only in its own format). The complicated setup seems to trigger stability issues, with the application frequently crashing after I exported texts to another format. The desktop version also needs polishing: one indispensable feature of WriteRoom that it lacks, for instance, is the ability to toggle between full-screen and window view on-the-fly [iv], which in MyTexts is treated as a preference setting rather than something you can switch as you draft a text.

I was much less impressed with the iOS versions, however, which I tested on both my iPad and my iPhone. At this point are still very much work in progress: all they offer is the possibility of creating texts in your dedicated MyTexts Dropbox sandbox folder, as well as opening and editing existing ones. You can't export in another format at all. In fact, the whole MyTexts ecosystem will only work well, for this reason, for someone who is content with storing their texts in a format that no other application can use, exporting them only from their Mac desktop. At this point, this simply doesn't make sense for my needs.

Using the Markdown script to automate conversion is the easiest way to simplify this process

So for the time being, I'm sticking with WriteRoom for my desktop editing needs. But I was keen to find a way of automating the Markdown conversion process, so that i don't have to fire up TextMate every time I finish drafting a text in WriteRoom, just for the purpose of converting to MarkDown—which is obviously absurd. I have become increasingly frustrated with the lack of inbuilt Markdown conversion in the two application I use on my desktop to draft (WriteRoom) and publish (MarsEdit) blog posts [v].

After thinking about it, I realised this issue was easily solved by creating a separate automated process to carry out the conversion and making it accessible within the two above applications. To do this, I decided to use Automator [vi]to create an OS X Menu Service that will convert selected text in any application from Fletcher Penney's excellent MultiMarkDown, which is a fork of MarkDown [vii], to HTML and copy the result to the keyboard. This is almost childishly simple. You open Automator and choose the 'Service' template for your workflow:

Using Automator to insert a menu service to convert MarkDown to HTML
Using Automator to insert a menu service is the easiest way to automatically convert MarkDown to HTML from selected text in any open application.

In the workflow pane, you check the 'Replaces selected text' box and add the conversion script of your choice choosing the 'Run Shell Script' action. You then add the script of your choice, with the path in which you've stored it, to the workflow pane. I also chose to add a command to pass on the resulting HTML to the clipboard:

The Automator workflow pane for the Markdown to HTML menu service
The Automator workflow pane for the Markdown to HTML menu service: You can set this to handle the converted text in any way you like. This setting gives you the widest set of options, leaving the converted text in the original application and sending it to the clipboard for pasting into another location.

I can either use this command in my text editor, WriteRoom (or any application), then open MarsEdit and paste the resulting HTML in the editing pane. Or I can paste the MultiMarkDown text into MarsEdit, which has a Markdown preview filter, and convert the text prior to posting it.

As a result of this, I can now dispense with TextMate altogether in the drafting process. this involves just two applications: drafting the post in WriteRoom; posting it in MarsEdit. My draft blog posts are all stored, in Markdown format, in a Dropbox folder, meaning if I want to access or edit them when I'm away from my mac I can do so from an iPhone or iPad. If desired, MarkdownMail and WordPress for iOS mean I can even publish blog posts from my mobile devices in an emergency without compromising code quality.

  1. Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz to help maximum readability and "publishability" of both its input and output forms. The language takes many cues from existing conventions for marking up plain text in email. Markdown converts its marked-up text input to valid, well-formed XHTML and replaces left-pointing angle brackets ('<') and ampersands with their corresponding character entity references. Markdown was originally implemented in Perl by Gruber, but has since been re-implemented by others in a variety of programming languages. It is distributed under a BSD-style license and is included with, or available as a plugin for, several content-management systems.
  2. In WordPress, this can be done using Michel Fortin's excellent plugin; if you blog using Tumblr or, even better, Posterous, you can post in Markdown as this is built in without your having to do anything to your blog's configuration.
  3. There is a plugin, Postie, for blogging by email, that seems well-maintained and feature-rich; but i haven't tested it; I'm basically put off the idea of sending posts in by email because of the lack of support for HTML.
  4. In WriteRoom you do this by pressing the ESC key.
  5. This is not necessary if you installed Michel Fortin's Markdown PHP plugin, or if you are posting to Tumblr or Posterous which support posting in Markdown out of the box.
  6. An alternative route for people wishing to save the resulting HTML texts as files would be to use a Hazel Preference Pane, running the Markdown script whenever a file containing a text has been updated. Since I use Markdown conversion to HTML solely to post to my website, and prefer storing blog posts
  7. Fletcher Penney explains the difference between MultiMarkDown and Markdown as follows: 'I wrote MultiMarkdown in order to leverage Markdown’s syntax, but to extend it to work with complete documents that could ultimately be converted from text into other formats, including complete XHTML documents, LaTeX, PDF, RTF, or even (shudder) Microsoft Word documents.'