This would have really benefited from looking over something like clojure’s hiccup: https://github.com/weavejester/hiccup