How to emit raw HTML with the Play Framework and Twirl template library

I’ll write more about this when I have some free time, but for the moment I’ll just say that if you ever need to emit raw HTML when using the Play Framework and Twirl template library, code like this will do the trick:

@play.twirl.api.HtmlFormat.raw(currentBookNode.bodyValue)

In this case the bodyValue field already contains HTML as a Scala String, and I don’t want Twirl to mess with that, so I use its HtmlFormat.raw method as shown.