Enlive and —

95 Views Asked by At

Trying to add an & mdash; between two divs using Enlive but

           {:tag :span,
             :attrs {:class "mdash"},
             :content "—"}

just returns the actual text & mdash; instead of drawing a —

Thoughts?

1

There are 1 best solutions below

0
claj On

Enlive will escape & for ordinary (content some-string), because that's a sane default.

To set raw HTML content and escaped characters, use html-content, which uses html-snippet under the hood.

Example

(html/html-snippet "&mdash;<p>hello</p>")

("—" {:tag :p,
      :attrs nil, 
      :content ("hello")})