Encoding - toddams/RazorLight GitHub Wiki

By the default RazorLight encodes Model values as HTML, but sometimes you want to output them as is.

Example

string content = "Hello @Model.Name";
var model = new
{
    Name = "\"John Doe\""
};

string result = engine.ParseString(content, model);

//Output - Hello "Jogn Doe"

Use @Raw() method to output value without encoding it

string content = "Hello @Raw(Model.Name)";

//Output - Hello "John Doe"