Scriban is a fast, powerful and lightweight text templating language and engine for .NET
var template = Template.Parse("Hello {{name}}!")
template.Render(new { name = "foo" }); // => "hi foo!" Scriban is similar to liquid or handlebars but provides additional support for:
- Real Lexer/Parser providing a full Abstract Syntax Tree, fast, versatile and robust, more efficient than a regex based parser.
- Precise control of whitespace text output
- Full featured expressions (
x = 1 + 2) - function call and pipes (
myvar | string.capitalize) - Complex objects (javascript/json like objects
x = {mymember: 1}) and arrays (e.gx = [1,2,3,4]) - Custom functions via
funcstatement and allow function pointers/delegates via thealias @ directive - Allow to pass a block of statements to a function, typically used by the
wrapstatement - Several builtins objects/functions:
- Multi-line statements without having to embrace each line by
{{...}} - Safe language and runtime, allowing you to control what objects and functions are exposed
- See the Language for a description of the language syntax and the built-in functions
- See the Runtime for the a description of the runtime API.
Compatible with the following .NET framework profiles:
.NET3.5.NET4.0+via the PCL profileportable40-net40+sl5+win8+wp8+wpa81NetStandard1.1running onCoreCLR
This software is released under the BSD-Clause 2 license.
- dotliquid: .NET port of the liquid templating engine by @tgjones
- Handlebars.Net: .NET port of handlebars.js by @rexm
Alexandre Mutel aka xoofx.