1/31/2006

AutoHotkey + Cygwin + Markdown = Kung Foo

I've recently been inspired by several sources to look at Markdown. I've long been looking for a way to document things in an open, neutral format and Markdown seems promising. The syntax is very simple (much simpler than TeX/LaTeX or XML) and people claim that you can get used to using it very quickly. Simple is good.

One of the easiest ways to generate formatted output from plaintext Markdown files is to use the perl script that is part of the official Markdown distribution. It's really simple to get this working - even on Windows. Take Markdown and add a little Cygwin... bingo! Again, simple is good.

After reading the "markdown for windows" article referenced above, I realized it would be really nice not to fire up a bash prompt and type a command just to get your Markdown converted to HTML. Enter AutoHotkey. (AutoHotkey is an OSS utility for writing Windows macros. I've been using it for a while, and I absolutely love it.) With AutoHotkey, you can add a keyboard macro definition similar to the following:

!#m::Run, "c:\cygwin\bin\bash" -c "getclip |/cygdrive/c/Markdown_1.0.1/Markdown.pl|putclip"

I now have the ability to enter Markdown anywhere, select it, cut/copy to the clipboard, hit WIN-ALT-M, and then paste my fresh HTML wherever I want it. To reiterate, simple is good.

Pure Kung Foo...

1 comment:

Mark said...

As the master says, "There are no beginner moves in martial arts." I'm glad you're enjoying Markdown. Simple is good.