RazorEngine has been moved to Github
Update - An early look at RazorEngine v3
New blog post - http://www.fidelitydesign.net/?p=473
Project Description
A templating engine built upon Microsoft's Razor parsing technology. The RazorEngine allows you to use Razor syntax to build robust templates. Currently we have integrated the vanilla Html + Code support, but we hope to support other markup languages in future.
Using the templating engine couldn't be easier, using a simple syntax, we can do the following:
string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });
The templating engine supports strict and anonymous types, as well as customised base templates, for instance:
Razor.SetTemplateBase(typeof(HtmlTemplateBase<>));
string template =
@"<html>
<head>
<title>Hello @Model.Name</title>
</head>
<body>
Email: @Html.TextBoxFor(m => m.Email)
</body>
</html>";
var model = new PageModel { Name = "World", Email = "someone@somewhere.com" };
string result = Razor.Parse(template, model);
NuGet Distribution
The Razor Templating Engine is available through Nuget (http://nuget.codeplex.com/) in Visual Studio. Simply search for RazorEngine in the package manager, or:
Install-Package RazorEngine
Support Us
Donations are always welcome and very appreciated :-), please
send donations via Paypal
Hope you enjoy, feedback is welcome!