« gmail and marketer control | Main | i know i'm not the only one »

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.

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

How geeky can you get? Just showing off?

For the extra-tasty goodness of Smarypants, download Smartypants and pipe through Smartypants.pl the same way.

getclip | Markdown.pl | Smartypants.pl | putclip

Fixes those single and double quotes as well as the ever-pervasive ellipsis (...)

This combo has been a boon to my productivity at work when having to mark up content documents.

Try this one:

Create a batch file called "markdown.bat". Stick the following in it:

C:\cygwin\bin\getclip.exe | C:\cygwin\bin\perl.exe C:\cygwin\home\{USER}\bin\Markdown.pl | C:\cygwin\bin\perl.exe C:\cygwin\home\{USER}\bin\Smartypants.pl | C:\cygwin\bin\putclip.exe

You'll need to edit paths as necessary.

Now you don't even need Cygwin open. I'm just trying to figure out a way to use AutoHotKey to call this batch file so I can just drag a selection, run that selection through Markdown/Smartypants, and then replace the selection with the HTML.

Of course you don't need actually need Cygwin at all, an ActivePerl install will do just fine. See http://downloads.activestate.com/ActivePerl/Windows/

Post a comment

If you have a TypeKey or TypePad account, please Sign In