var model = new { Content = ... } Razor.Parse(templateBody,model)
如何使用独立Razor渲染此字符串.
我试过了:
@(new HtmlString(Model.Content))
并且
@(HttpUtility.HtmlDecode(Model.Content))
Model.Content始终呈现HTML转义.
@Raw("<script>alert('!');</script>")
为了说服VS和Resharper给你IntelliSense在模板的顶部添加以下行:
@inherits RazorEngine.Templating.TemplateBase