CLI tool
scriban/scriban avatar
scriban/scriban

Scriban: parse a liquid template, then write it back out as Scriban

A fast, powerful, safe and lightweight scripting language and engine for .NET

3,998 stars415 forksC#BSD-2-Clause

At a glance

What is it?
A .NET template and scripting engine whose liquid compatibility mode is not just a reader: the parsed AST can be printed back to source with Template.ToText, which makes migration a mechanical step, and whose default member renaming turns MyMethodIsNice into my_method_is_nice unless you pass a delegate.
Who is it for?
Reach for it when templates have to survive a round trip, because the AST is visitable and printable and a liquid template can be parsed and re-emitted as Scriban source, which few .NET templating engines offer. Two things to know before you write the first template.
Can I use it commercially?
Yes. BSD-2-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 7 days ago.
What is it written in?
Mainly C#, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • scriban/scriban3,998 ★ · +29
Star history
Repository2026-09-242026-11-15
scriban/scriban4k4k

29 Stars in the last 52 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Liquid compatibility is a reader and a rewriter

Two entry points, one render call. A Scriban template goes through `Template.Parse`, a liquid one through `Template.ParseLiquid`, and both hand back something you render the same way:

csharp
// Parse a scriban template
var template = Template.Parse("Hello {{name}}!");
var result = template.Render(new { Name = "World" }); // => "Hello World!"
csharp
// Parse a liquid template
var template = Template.ParseLiquid("Hello {{name}}!");
var result = template.Render(new { Name = "World" }); // => "Hello World!"

What makes the mode more than a compatibility shim is the AST to text path. Call `Template.ToText` on a template that was parsed as liquid and you get Scriban source back, which the README frames as the way to migrate an existing liquid script to Scriban without rewriting it by hand. The same mechanism works in the other direction for editing: parse, walk the tree, write it out.

The caveat is stated in the same bullet list. Liquid is less powerful than Scriban, which is the point of the migration, but liquid as a language is not strictly defined and there are in fact various versions of liquid syntax, so using liquid templates with Scriban comes with restrictions, and the project sends you to a separate document for them rather than enumerating them here.

MyMethodIsNice is exposed as my_method_is_nice

The default naming convention is the first thing that surprises people, and it is deliberate. Properties and methods of .NET objects are automatically exposed with lower-case and underscore names, so a property like `MyMethodIsNice` appears in a template as `my_method_is_nice`. The reason given is historical: the convention was chosen to match the behaviour of liquid templates, so a template ported from liquid keeps working.

The escape hatch is a delegate. A `MemberRenamer` can be supplied to change the mapping, which is the supported way to keep PascalCase names visible in templates. The broader runtime control lives on the same object, `TemplateContext`, which carries options for relaxed member access, relaxed function access, relaxed target access and relaxed indexer access. Those four switches are what let a host decide how much of an object graph a template is allowed to walk, and they are per-context rather than global, so two templates in the same process can have different rules.

The default is the loose end of this design. A fresh context exposes the members of anything handed to it, renamed, so the safe configuration is one the host has to build rather than one it inherits.

The AST is visitable, and it prints itself back

Three properties of the syntax tree make Scriban usable as more than a renderer. The AST is fully visitable through a `ScriptVisitor`, so you can analyse or transform a template before rendering it. Every `ScriptNode` carries parent links, which is what makes a walk upward possible rather than only downward. And the tree can be written back to a script textual representation with `Template.ToText`.

The round trip is the practical consequence. A template can be loaded from disk, parsed, inspected or modified in memory, and re-saved, which the README describes as useful for roundtrip script update scenarios. Error reporting is at the same level of detail: the lexer and parser keep precise source locations with path, column and line, so a template error points at a place in a file rather than at a character offset.

The parser itself is described as a full abstract syntax tree from a lexer and parser pair, positioned as more efficient than regex based parsers, and the runtime as lightweight and friendly to both CPU and the garbage collector. Those are the project's claims about its own shape; no benchmark appears in the README to support them.

The sandbox is a whitelist, and the limits can truncate instead of throwing

The safety story is an extensible sandbox execution model in which the host has full control over which scripting objects, and therefore which properties and methods, a template can reach. Nothing is exposed implicitly beyond what the context is given, so the security boundary is assembled by the host rather than discovered by the template author.

The limits are the part with a design decision in it. String and output limits are configurable, and the two are set independently, each with a choice between truncation and raising an exception. So a template that generates a 40 MB string can be configured to cut it off at a length and keep rendering, or to stop with an error, and the same choice is available separately for total output size. For a service rendering many users' templates that is a real distinction: truncation degrades one template, an exception can take down the request.

The same runtime also offers evaluation helpers, `object.eval` and `object.eval_template`, which let a template evaluate code or another template at runtime. That is a capability rather than a leak, and it is worth knowing about before exposing a template to a user who can write their own.

Two target frameworks, and the package carries its own source

Installation is one command:

sh
dotnet add package Scriban

The package targets `netstandard2.0` and `net8.0`, which is what makes it usable from .NET 6 and later, from .NET Framework 4.7.2 and later, and from other compatible runtimes. A second package, Scriban.Signed, provides signed assemblies for environments that require them.

The more unusual decision is source embedding. The package includes Scriban's source files, so a project can internalize the engine into its own assembly instead of taking a binary dependency, and the README names the case it is for: environments where NuGet references are not convenient, such as Roslyn source generators. That also explains why the plain package is larger than a compiled dependency would be, and why the signed variant exists as a separate download rather than as a flag.

Native AOT is the third packaging story, with a catch. AOT and trimming compatibility is offered on .NET 8 and later, and the AOT-safe surface is a documented subset, with `ScriptObject` based APIs producing zero linker warnings. Native AOT support therefore comes with the understanding that you stay inside the surface the guides list.

Three parsing modes, one of them scientific

The mode is chosen through a language and a mode pair, `ScriptLang` and `ScriptMode`, and the README names three: Scriban, Liquid and Scientific. Scientific is not described anywhere else in the document, so what syntax it enables is something you have to look up.

The rest of the language surface is enumerated. Numbers can be written in hexadecimal and binary and can be large integers. Functions can be parametric and inline, and custom functions can be added to the language itself with the `func` statement, while function pointers and delegates come in through the `alias @` directive from the runtime side. A block of statements can be passed to a function, which is what the `wrap` statement is for. Optional member access uses `?.`, and there are conditional expressions. Statements can span multiple lines without being wrapped in `{{` and `}}`.

Built-in functions are grouped into namespaces rather than a flat list: array, date, html, math, object, regex, string and timespan, which is also how pipes read, as in `myvar | string.capitalize`. Objects and arrays use a JavaScript-like literal syntax, `x = {mymember: 1}` and `x = [1,2,3,4]`, and the control flow is the expected if, else, for and while. Whitespace output is controlled precisely, which is the feature template authors notice first when output starts carrying stray blank lines.

7.5.0 was published two minutes after the last commit

The release cadence is fast and unusually precise. Version 7.3.0 shipped on 2026-09-04, 7.4.0 on 2026-09-05, and 7.5.0 on 2026-09-21 at 17:35:04, while the last push to the default branch is timestamped 2026-09-21 at 17:32:38. The newest release was therefore cut two minutes and change after the last commit, and three versions landed inside seventeen days. The coveralls badge in the README is pinned to the master branch, which is also the default branch.

Two housekeeping details are worth copying before you file anything. The readme at the top level is spelled readme.md in lower case, and the licence file is license.txt, also lower case, which matters on case-sensitive filesystems. The README's own licence section then stops mid-word, at the two characters This s, so the licence text has to be read from license.txt rather than from the README.

The rest of the tree is small and says something about how the project is worked on: an .editorconfig, .gitattributes, .gitignore, a .github/ directory, AGENTS.md and CLAUDE.md side by side, an img/ directory, site/ for the documentation that lives at scriban.github.io, and src/. The agent instruction files at the top of a language repository are the newest thing here, and the README does not mention them at all.

Editorial conclusion

Reach for it when templates have to survive a round trip, because the AST is visitable and printable and a liquid template can be parsed and re-emitted as Scriban source, which few .NET templating engines offer. Two things to know before you write the first template. Members of your .NET objects are exposed as snake_case names, so any PascalCase property needs a MemberRenamer delegate or a template that guesses wrong, and the liquid mode has documented restrictions because liquid itself has no single strict definition. On packaging, the ordinary NuGet package already embeds Scriban's own source, so internalizing it costs nothing extra, while Native AOT support is limited to the AOT-safe surface on .NET 8 and later.

Frequently asked questions

What is Scriban.Signed?

A separate NuGet package, Scriban.Signed, which provides signed assemblies of Scriban. The ordinary Scriban package is installed with dotnet add package Scriban and targets netstandard2.0 and net8.0, so it works with .NET 6 and later and with .NET Framework 4.7.2 and later. The signed package exists for environments that require signed binaries.

How does Scriban compare to liquid?

Scriban is more powerful than liquid, and it can read liquid through Template.ParseLiquid and render it with the same Render call. Because the parsed AST can be printed back to source with Template.ToText, a liquid script can be converted into Scriban source mechanically rather than rewritten. The README also states the limit plainly: liquid is not strictly defined and there are various versions of liquid syntax, so liquid templates have restrictions under Scriban, documented separately.

How do I install Scriban and what runtimes does it support?

As a NuGet package with dotnet add package Scriban. It targets netstandard2.0 and net8.0, so it works with .NET 6 and later, with .NET Framework 4.7.2 and later, and with other compatible runtimes. The package also embeds Scriban's own source files, so the engine can be internalized into a project instead of consumed as a binary, which the README recommends for cases such as Roslyn source generators.

How do I control what a Scriban template can access?

Through the sandbox execution model and the TemplateContext options. The host decides which scripting objects, and so which properties and methods, a template can reach, and TemplateContext carries switches for relaxed member, function, target and indexer access. String and output limits are configurable and independent of each other, each with a choice between truncating and raising an exception.

Why does my PascalCase property not show up in a Scriban template?

Because .NET members are exposed as lower-case snake_case names by default, so MyMethodIsNice becomes my_method_is_nice. The convention was chosen to match liquid template behaviour. To change it, supply a MemberRenamer delegate, which is the supported way to map .NET member names to the names templates use.

Can Scriban be used as a scripting engine without templates?

Yes. The README says Scriban can be used in a pure scripting context without the {{ and }} delimiters, for small DSLs of your own, and describes it as a general scripting engine as well as a templating one. It is the core of the scripting engine in kalk, a command line calculator for developers, and offers async evaluation through Template.RenderAsync plus runtime helpers object.eval and object.eval_template.

Official sources

  1. License: BSD-2-Clause
  2. Project website
  3. README
  4. Releases
  5. scriban/scriban on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/scriban-scriban.svg)](https://hysenlabs.com/projects/scriban-scriban)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/scriban-scriban.svg)](https://hysenlabs.com/projects/scriban-scriban)

Was this useful?