September 04, 2004

markdown for windows

Taking inspiration from Merlin Mann’s fantastic 43 Folders, here’s a quick hint for those of you who are just dying to use John Gruber’s Markdown (the script version, not the MT plugin version, though use of it there is obviously encouraged) on Windows.

I assume, of course, that if you’re looking to use Markdown on Windows, you’ve taken the first important step and installed Cygwin in order to afford yourself a proper bash environment and a local install of Perl. (If not, well, go do that first and come back here later.) If you’re already there, then all you need to do is…

  1. Download Markdown and unzip it to a directory of your choice. Mine is dumped into ~/stuff/bin.

  2. Launch your Cygwin shell. Make sure that your Cygwin install has getclip and putclip installed (they should be in your /usr/bin). These little utilities give Cygwin access to the Windows clipboard.

  3. Open up a text editor, write some text in Markdown syntax. Copy it to your clipboard.

  4. Alt-tab over to your Cygwin shell and type the command _getclip /path/to/your/Markdown.pl putclip_. This should (silently) get the contents of your Windows clipboard, pipe it through Markdown, and put it back out to your clipboard.
  5. Alt-tab over to your text editor, hit CTRL-V, and enjoy properly marked-down text.

For speed, edit your .bashrc (or equivalent) to create an alias for that command up there to something easier to remember, and faster to type.

Enjoy.