hhtml: Static Site Generator in Haskell

◷ 5 min read

✏ published 2022-01-25

Jack Leightcap

Contents

- Background: What is a "Static Site Generator"?

- What is hhtml?

- General Notes, Haskell

Background: What is a "Static Site Generator"?

This website is "built" from a bunch of Markdown files. They're automatically converted (compiled) to the format you're reading, and some glue is in place to make things look nice. There's plenty of solutions to do this already (Hugo, Gatsby, Jekyll); but why use someone else's solution when I can roll my own shitty replacement.

Why even set up a website this way?

What is hhtml?

hhtml is a compiler to transform Markdown into a user-served format (currently HTML and GMI).

By writing my own compiler, I can tinker with, and deeply embed configuration for, each piece of the compiled output. For example, I wanted some flags available as some options in the header of each file:

---
author: Jack Leightcap
date: 2022-01-25
read: 5 min
style: ../style.css
title: hhtml: Static Site Generator in Haskell
toc: True
---

General Notes, Haskell

Writing a static site generator is a really great exercise in compiler engineering. For Haskell specifically, the problem involves a small, but non-trivial, use of