Last Updated: February 25, 2016
· rodnaph

Append HTML with Enlive

Setting the content of nodes to either escaped text (using content), or HTML (using html-content) is pretty obvious. But here's how you can use HTML with the other Enlive transformers.

[:div] (append (html [:script "alert('Hello, World!')"]))

The html function takes a Hiccup style data structure of nodes which it will convert to an Enlive map for the HTML.

(html [:div.control-group [:label.control-label "Label:"]])

Very useful.