Literate Haskell Blogging

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.take`id`20$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).

One Response so far »

  1. 1

    main = putStrLn “Hello, World!” « unsafeReadBlog said,

    January 20, 2009 @ 8:32 am

    [...] *(Things getting markdown installed, and then getting it working with haskell hilighting. Shall be following in the steps of Conal Elliot and Olsner) [...]

Comment RSS · TrackBack URI

Say your words