using RazorEngine.Templating;
using System.Text.RegularExpressions;
static void Main(string[] args)
var template = @"Hi. Today is @DateTime.Now. @if (Model.IsReady) { <text>I see you are ready.</text> } else {<text>I'm sorry you're not ready.</text>}";
var model = new { IsReady = true };
var result = Engine.Razor.RunCompile(template, "template", null, model);
result = Regex.Replace(result, "<.*?>", string.Empty);
Console.WriteLine(result);