How do I output raw html when using RazorEngine (NOT from MVC)

FYI I have a fork that includes the @Html.Raw(...) syntax here:

https://github.com/Antaris/RazorEngine/pull/105


I am using RazorEngine 3.8.2 and @Raw(Model.Content) is working perfectly fine for me.


RazorEngine, like MVC's Razor View Engine, will automatically encode values written to the template. To get around this, we've introduce an interface called IEncodedString, with the default implementations being HtmlEncodedString and RawString.

To use the latter, simply make a call to the inbuilt Raw method of TemplateBase:

@Raw(Model.EmailContent)