Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 887 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 887 Bytes

blaze-html-qq

CI

QuasiQuoter for blaze-html. Parse inline HTML snippets at compile time and produce MarkupM values, e.g.

{-# language QuasiQuotes #-}
-- blaze-html
import qualified Text.Blaze.Html.Renderer.Text as BT (renderHtml)
-- text
import qualified Data.Text.Lazy as TL (Text)


import Text.Blaze.HTML.QQ (blaze)

test :: TL.Text
test = BT.renderHtml [blaze|
<div>
  <h1 class="widget" style="potato">
  Hello!
  </h1>
</div>
|]
> test
"<div><h1 class=\"widget\" style=\"potato\">Hello!</h1></div>"

This can play well alongside server-side web frameworks such as HTMX and scotty.