Scriban 7.0.0
Prefix Reserveddotnet add package Scriban --version 7.0.0
NuGet\Install-Package Scriban -Version 7.0.0
<PackageReference Include="Scriban" Version="7.0.0" />
<PackageVersion Include="Scriban" Version="7.0.0" />
<PackageReference Include="Scriban" />
paket add Scriban --version 7.0.0
#r "nuget: Scriban, 7.0.0"
#:package Scriban@7.0.0
#addin nuget:?package=Scriban&version=7.0.0
#tool nuget:?package=Scriban&version=7.0.0
scriban

<img align="right" width="160px" height="160px" src="img/scriban.png">
Scriban is a fast, powerful, safe and lightweight scripting language and engine for .NET, which was primarily developed for text templating with a compatibility mode for parsing liquid templates.
Today, not only Scriban can be used in text templating scenarios, but also can be integrated as a general scripting engine: For example, Scriban is at the core of the scripting engine for kalk, a command line calculator application for developers.
// Parse a scriban template
var template = Template.Parse("Hello {{name}}!");
var result = template.Render(new { Name = "World" }); // => "Hello World!"
Parse a Liquid template using the Liquid language:
// Parse a liquid template
var template = Template.ParseLiquid("Hello {{name}}!");
var result = template.Render(new { Name = "World" }); // => "Hello World!"
The language is very versatile, easy to read and use, similar to liquid templates:
var template = Template.Parse(@"
<ul id='products'>
{{ for product in products }}
<li>
<h2>{{ product.name }}</h2>
Price: {{ product.price }}
{{ product.description | string.truncate 15 }}
</li>
{{ end }}
</ul>
");
var result = template.Render(new { Products = this.ProductList });
Scriban can also be used in pure scripting context without templating ({{ and }}) and can help you to create your own small DSL.
By default, Properties and methods of .NET objects are automatically exposed with lowercase and _ names. It means that a property like MyMethodIsNice will be exposed as my_method_is_nice. This is the default convention, originally to match the behavior of liquid templates.
If you want to change this behavior, you need to use a MemberRenamer delegate
Highlights
- Fully visitable AST with
ScriptVisitor, parent links onScriptNode, and round-trippable formatting withTemplate.ToText. - Flexible language features including hexadecimal/binary numbers, large integers, parametric and inline functions, optional member access (
?.), and conditional expressions. - Multiple parsing modes through
ScriptLangandScriptMode, including Scriban, Liquid, and Scientific parsing. - Fine-grained runtime control through
TemplateContextoptions such as relaxed member, function, target, and indexer access. - Runtime evaluation helpers such as
object.evalandobject.eval_template. - Async rendering support with
Template.RenderAsync. - Native AOT and trimming-friendly APIs on .NET 8+ when using the AOT-safe surface documented in the runtime guides.
Features
- An extensible sandbox execution model: You have the full control about which Scripting objects (and so properties and methods) are accessible from Scriban templates.
- Very efficient, fast parser and a lightweight runtime. CPU and Garbage Collector friendly.
- Powered by a Lexer/Parser providing a full Abstract Syntax Tree, fast, versatile and robust, more efficient than regex based parsers.
- Precise source code location (path, column and line) for error reporting
- Write an AST to a script textual representation, with
Template.ToText, allowing to manipulate scripts in memory and re-save them to the disk, useful for roundtrip script update scenarios
- Compatible with
liquidby using theTemplate.ParseLiquidmethod- While the
liquidlanguage is less powerful than scriban, this mode allows to migrate fromliquidtoscribanlanguage easily - With the AST to text mode, you can convert a
liquidscript to a scriban script usingTemplate.ToTexton a template parsed withTemplate.ParseLiquid - As the liquid language is not strictly defined and there are in fact various versions of liquid syntax, there are restrictions while using liquid templates with scriban, see the document liquid support in scriban for more details.
- While the
- Extensible runtime providing many extensibility points
- Support for
async/awaitevaluation of scripts (e.gTemplate.RenderAsync) - Precise control of whitespace text output
- Full featured language including
if/else/for/while, expressions (x = 1 + 2), conditions... etc. - Function calls and pipes (
myvar | string.capitalize)- Custom functions directly into the language via
funcstatement and allow function pointers/delegates via thealias @ directive - Bind .NET custom functions from the runtime API with many options for interfacing with .NET objects.
- Custom functions directly into the language via
- Complex objects (javascript/json like objects
x = {mymember: 1}) and arrays (e.gx = [1,2,3,4]) - Allow to pass a block of statements to a function, typically used by the
wrapstatement - Several built-in functions:
array,date,html,math,object,regex,string,timespan - Multi-line statements without having to embrace each line by
{{...}} - Safe parser and safe runtime, allowing you to control what objects and functions are exposed
- AOT and trimming compatible on .NET 8+.
ScriptObject-based APIs produce zero linker warnings for Native AOT publishing
Syntax Coloring
You can install the Scriban Extension for Visual Studio Code to get syntax coloring for scriban scripts (without HTML) and scriban html files.
Documentation
The full documentation is available at https://scriban.github.io.
Installation
Scriban is available as a NuGet package:
dotnet add package Scriban
The package targets netstandard2.0 and net8.0, so it works with .NET 6+, .NET Framework 4.7.2+, and other compatible runtimes.
Also the Scriban.Signed NuGet package provides signed assemblies.
Source Embedding
The package includes Scriban source files so that you can internalize Scriban into your project instead of consuming it only as a binary dependency. This is useful in environments where NuGet references are not convenient, such as Roslyn source generators.
Currently, Scriban source files are not marked as read-only in this mode. Do not modify them unless you intend to affect other projects on the same machine that use the embedded sources. Use this feature at your own risk.
In order to activate this feature you need to:
- Set the property
PackageScribanIncludeSourcetotruein your project:<PropertyGroup> <PackageScribanIncludeSource>true</PackageScribanIncludeSource> </PropertyGroup> - Add the
IncludeAssets="Build"to the NuGet PackageReference for Scriban:<ItemGroup> <PackageReference Include="Scriban" Version="x.y.z" IncludeAssets="Build" /> </ItemGroup>
If you are targeting netstandard2.0 or .NET Framework 4.7.2+, you will also need the supporting packages Scriban compiles against. They can already come from another dependency in your project:
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
</ItemGroup>
In this mode, all Scriban types are marked as internal.
System.Text.Json-based features are intentionally disabled in source-embedding mode. This includes helpers such as object.from_json, object.to_json, and direct JsonElement import support.
License
This software is released under the BSD-Clause 2 license.
Related projects
- dotliquid: .NET port of the liquid templating engine
- Fluid .NET liquid templating engine
- Nustache: Logic-less templates for .NET
- Handlebars.Net: .NET port of handlebars.js
- Textrude: UI and CLI tools to turn CSV/JSON/YAML models into code using Scriban templates
- NTypewriter: VS extension to turn C# code into documentation/TypeScript/anything using Scriban templates
Online Demo
- Main site and playground: https://scriban.github.io
- Legacy sample: https://scribanonline.azurewebsites.net/ ASP.NET Core sample
Sponsors
Supports this project with a monthly donation and help me continue improving it. [Become a sponsor]
<img src="https://github.com/lilith.png?size=200" width="64px;" style="border-radius: 50%" alt="lilith"/> Lilith River, author of Imageflow Server, an easy on-demand image editing, optimization, and delivery server
Credits
Adapted logo Puzzle by Andrew Doane from the Noun Project
Author
Alexandre Mutel aka xoofx.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 10.0.5)
- System.Threading.Tasks.Extensions (>= 4.6.3)
-
net8.0
- No dependencies.
NuGet packages (235)
Showing the top 5 NuGet packages that depend on Scriban:
| Package | Downloads |
|---|---|
|
Volo.Abp.TextTemplating.Scriban
Package Description |
|
|
Serenity.CodeGenerator
Generates server and script side code for Serenity platform applications |
|
|
Miru.Core
Package Description |
|
|
Volo.Docs.Domain.Shared
Package Description |
|
|
RecommendationsGatewayModule.Data
Package Description |
GitHub repositories (60)
Showing the top 20 popular GitHub repositories that depend on Scriban:
| Repository | Stars |
|---|---|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
|
spectreconsole/spectre.console
A .NET library that makes it easier to create beautiful console applications.
|
|
|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 10, 9, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.
|
|
|
openiddict/openiddict-core
Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET
|
|
|
focus-creative-games/luban
luban是一个强大、易用、优雅、稳定的游戏配置解决方案。luban is a powerful, easy-to-use, elegant and stable game configuration solution.
|
|
|
martinothamar/Mediator
A high performance implementation of Mediator pattern in .NET using source generators.
|
|
|
GitTools/GitVersion
From git log to SemVer in no time
|
|
|
microsoft/onefuzz
A self-hosted Fuzzing-As-A-Service platform
|
|
|
serenity-is/Serenity
Business Apps Made Simple with Asp.Net Core MVC / TypeScript
|
|
|
belav/csharpier
CSharpier is an opinionated code formatter for c#.
|
|
|
sebastienros/fluid
Fluid is an open-source .NET template engine based on the Liquid template language.
|
|
|
statiqdev/Statiq
Statiq is a flexible static site generator written in .NET.
|
|
|
neozhu/CleanArchitectureWithBlazorServer
This repository is designed to create an enterprise Blazor Server application that follows the principles of Clean Architecture and implements Blazor Clean Architecture best practices for scalability, maintainability, and testability.
|
|
|
xoofx/ultra
An advanced profiler for .NET Applications on Windows
|
|
|
colinin/abp-next-admin
这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
|
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
|
bing-framework/Bing.NetCore
Bing是基于 .net core 3.1 的框架,旨在提升团队的开发输出能力,由常用公共操作类(工具类、帮助类)、分层架构基类,第三方组件封装,第三方业务接口封装等组成。
|
|
|
streetwriters/notesnook-sync-server
Sync server for Notesnook (self-hosting in alpha)
|
|
|
luoyunchong/lin-cms-dotnetcore
😃A simple and practical CMS implemented by .NET + FreeSql;前后端分离、Docker部署、OAtuh2授权登录、自动化部署DevOps、自动同步至Gitee、代码生成器、仿掘金专栏
|
|
|
luokaTime/kaylamariehy
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 7.0.0 | 477 | 3/22/2026 | |
| 6.6.0 | 29,038 | 3/19/2026 | |
| 6.5.8 | 10,098 | 3/16/2026 | |
| 6.5.7 | 15,215 | 3/11/2026 | |
| 6.5.6 | 533 | 3/11/2026 | |
| 6.5.5 | 30,346 | 3/5/2026 | |
| 6.5.4 | 12,283 | 3/4/2026 | |
| 6.5.3 | 76,001 | 2/18/2026 | |
| 6.5.2 | 588,312 | 11/25/2025 | |
| 6.5.1 | 110,799 | 11/17/2025 | |
| 6.5.0 | 207,119 | 10/27/2025 | |
| 6.4.0 | 386,730 | 9/21/2025 | |
| 6.3.0 | 242,737 | 9/11/2025 | |
| 6.2.1 | 1,830,830 | 4/18/2025 | |
| 6.2.0 | 1,642,740 | 4/7/2025 | |
| 6.1.0 | 29,740 | 4/1/2025 | |
| 6.0.0 | 291,980 | 3/6/2025 | |
| 5.12.1 | 1,380,844 | 12/18/2024 | |
| 5.12.0 | 422,900 | 11/13/2024 | |
| 5.11.0 | 336,540 | 11/1/2024 |