Archive for February, 2008

Literate Haskell Blogging

Feb 05, 2008 by olsner

An unfortunate thing with this markdown framework I've been using is that it requires me to indent code blocks by four spaces (or a tab). Editing such text in a web browser really sucks, so I've been thinking about how to hack in literate haskell support into markdown. Well, turns out, it wasn't that hard after all.

After some real simple modification to the markdown+geshi patch referenced in my previous blog post I now have literate haskell support! The modification literally took less time than writing this post ;-) Find my new patch attached at the bottom of the page.

So - the testing! (This should render as normal text.)

and "this" {-should-} -- be rendered as haskell

Now some normal text in between the haskell blocks, before we give haskell highlighting a run for its money.

and . more . haskell $ [1,2,3] main = print.takeid20$fix$(.)<$>(:)<>((.((:[]).))(=<<).().(*2))$1 -- print an interesting sequence

End of test.

Anyway, here's the patch for markdown.php (you'll also need to cut-n-paste the highlight_helper.php file from Dougal Stanton's blog).