Markdown

· technology ·

John Gruber has produced another text-to-HTML filter, called Markdown. I use Textile extensively when writing this weblog, and find it very useful. I do know how to write HTML, and I don't find it particularly hard, but using a filter like this just makes it a bit quicker to write — and perhaps more importantly — easier to read and edit. If there's too much 'code furniture' on a page, it can be hard to pick up spelling or grammatical errors. Sometimes it's hard to motivate yourself to write, and then any kind of barrier between you and the words on the screen becomes more significant.

Markdown has a smaller syntax set than Textile, but it seems that this is deliberate. It only allows you to encode the kind of HTML formatting that can be represented with plain text. As John Gruber explains:

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown's formatting syntax only addresses issues that can be conveyed in plain text.

This produces very clean markup, which is extremely readable. I particularly like the ability to form reference style links. To keep the main text as uncluttered as possible, you can refer to a URL as follows:

[Google][1]

and have all the referenced URLs listed anywhere else in the document like so:

[Google]: http://www.google.com "Optional title"

It works very neatly and makes it much easier to accumulate links at the bottom of the document as you are researching and writing, and then mark up the links in the text (the references at the bottom are converted to proper inline URLs).

I also like the fact that you can use Markdown to filter text files at the command line, or as a Unix filter in BBEdit, so that you can easily convert any piece of text intended for the web. I'm going to use the filter for a while and see if I get on with it — if I do, I'll set up the preferences so that you can also use Markdown in the comments.

Update: For those of you not reading the comments, John Gruber pointed out an error in my examples. With the URL given in the text as:

[Google][1]

you need a reference like this:

[1]: http://www.google.com "Optional title"