How can I add a class to a preEscapedToHtml?
renderHtml $ preEscapedText "<div>a</div>" ! class_ "c"
"<div>a</div>"
or to an HTML generated by a hamlet template?
however this works:
renderHtml $ H.div "a" ! class_ "c"
"<div class=\"c\">a</div>"
The most accurate type in Blaze for an HTML tag is
Tag.H.divis of that type, is it not? What shouldpreEscapedText "<title>Example</title><p>HTML document" ! class_ "c"do anyway? Attributes can only be added to tags, and not to HTML documents or fragments. Thus you should keep your tags with typeTaguntil you've added all attributes you need and are ready to combine multiple tags into a HTML fragment or document. If you need to keep track of multiple nodes you're generating in parallel, you can store them in a list, tuple or a record while you're modifying them. Then merge then into anHTMLat the end.