Ginger is a template language for HTML.
Its main inspiration is Jinja2, a popular template language for Python, used in frameworks like Flask. Similar template engines have been implemented in other languages, such as PHP’s Twig. Ginger does the same for Haskell, adding a few things that are possible because of Haskell’s type system.
- DOM-agnostic: Ginger doesn’t know anything about the HTML DOM; as far as we are concerned, HTML source is just a stream of bytes, and all we know is how to encode data as HTML and how to glue snippets of HTML together.
- HTML superset-ish: Ginger is (almost) a superset of HTML. This means that a valid Ginger template is (almost) a valid HTML document.
- Mostly Jinja-compatible: Ginger aims to be template-compatible with Jinja, but sacrificing the bits that don’t make sense in a Haskell host application.
- Sandboxable: Ginger is designed such that it can only ever touch things that the host application explicitly exposes.
A guided introduction to Ginger and its template syntax.
If you want to learn how to write Ginger templates, this is the place to look.
API reference on Hackage. Useful if you want to use Ginger in your Haskell projects.