It has taken me a while to find a quick and dirty method of taking notes electronically. Most document formats suck, and they’ll bite me at one point or another, and LaTeX, while incredibly powerful for writing a book, is a bit of an overkill for shorter texts.

Enter Markdown. Quoting its maker, Markdown is

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).

If you’ve never seen a Markdown text, it is plain text with a few very simple formatting rules. Markdown’s syntax is easy to learn, and makes the text look rather good in a plain text editor as well as converted to HTML or other formats.

Converting Markdown to …

Markdown isn’t a one-way street beause, as it is plain text, it can quite easily be converted to other formats. Here are some methods:

  • Pandoc is a Haskell library/command-line utility for converting from one markup format to another. It reads Markdown (among other formats) and creates LaTeX, RTF, XML, ODT, and others. It is a bit of a PITA to install on Mac OS X (I tried compiling a late version and gave up after two hours, reverting to 0.46, which did compile), but it is really worth it. Its markdown2pdf program alone, is worth the effort. Pandoc 1.2 was trouble-free.

  • If you want a C library to parse Markdown files, use discount.

Markdown on Mac OS X

There are at least two plugins to add Quicklook support for Markdown files: the original by Phillip Toland calls in Perl to do the formatting, and a fork by Michael Dominic K which uses the discount C library to do the formatting. Both plugins are available as compiled binaries with source code if you need to “fix” it.

These plugins both allow me to locate a file with a .markdown extension in Mac OS X’ Finder, press a space bar to see the formatted result: Markdown is easy to “write”, readable without special tools, good-looking when rendered into a different format, and all in all, a simple way of getting things done. I strongly recommend you have a look at it.

Read more

Linux, MacOSX, and CLI :: 02 May 2009 :: e-mail