The most popular format for specifying HTML in Clojure is Hiccup, by James Reeves. It has spawned variants like sablono and reagent which return React components rather than HTML strings.
This summer I read Matthew Butterick's explanation of X-Expressions, then discovered a related paper and additional references via Jack Rusher. My intuition about what hiccup
is began to shift from "a way to generate HTML in Clojure" to "an implementation of X-Expressions in Clojure using vectors".
This library, x-vec
, is a small toolset for building 'emitters' that output different kinds of useful things from X-Vector notation. For example:
- React components (just like Sablono/Reagent)
- GraphQL queries
- Code ASTs
Having previously written a hiccup variant myself, I used that code as well as some prior drafts for a graphql emitter as the starting point for this repo.
- Matthew Butterick's description of X-Expressions: http://docs.racket-lang.org/pollen/second-tutorial.html#%28part._.X-expressions%29
- The paper, X-expressions in XMLisp: S-expressions and Extensible Markup Language Unite
- The Next 700 Markup Languages
- The very first README for @weavejester's Hiccup library