Back in February, I had an idea for a templating language like MDX, except being able to evaluate + interpolate Haskell expressions instead of Javascript. I finally got around to finishing it up, and got the prototype working!
My eventual goal was to also create a static site generator built on top of this (think hakyll, but opinionated + more batteries included); we’ll see if I get around to that aspect. But templette was the first step towards that.
It’s not on Hackage yet, to avoid name squatting on two package names, but if there’s interest, I could push it up any time. Also, if you’re interested in contributing, there’s certainly lots to do (anyone looking for practice on a small package??). Just let me know and we can coordinate.
Here’s a quick preview (but a bigger example is provided in the README):
-
input.ths-md
:
{$setup}
double :: Int -> Int
double = (* 2)
{$end}
2 * 2 = {show $ 2 * 2}
-
templette-markdown --render input.ths-md
:
2 * 2 = 4