Soenneker.Extensions.Strings.Templating
11.0.337
Prefix Reserved
dotnet add package Soenneker.Extensions.Strings.Templating --version 11.0.337
NuGet\Install-Package Soenneker.Extensions.Strings.Templating -Version 11.0.337
<PackageReference Include="Soenneker.Extensions.Strings.Templating" Version="11.0.337" />
<PackageVersion Include="Soenneker.Extensions.Strings.Templating" Version="11.0.337" />
<PackageReference Include="Soenneker.Extensions.Strings.Templating" />
paket add Soenneker.Extensions.Strings.Templating --version 11.0.337
#r "nuget: Soenneker.Extensions.Strings.Templating, 11.0.337"
#:package Soenneker.Extensions.Strings.Templating@11.0.337
#addin nuget:?package=Soenneker.Extensions.Strings.Templating&version=11.0.337
#tool nuget:?package=Soenneker.Extensions.Strings.Templating&version=11.0.337
Soenneker.Extensions.Strings.Templating
Render Scriban templates from a string with dictionary-backed global values and a short-lived parse cache.
Installation
dotnet add package Soenneker.Extensions.Strings.Templating
Render values
using Soenneker.Extensions.Strings.Templating;
var values = new Dictionary<string, object?>
{
["customer_name"] = "Ada",
["items"] = new[] { "Keyboard", "Mouse" }
};
string template = "Hello {{ customer_name }}. {{ items | array.size }} items are ready.";
string result = await template.Render(values);
Dictionary keys become top-level Scriban variables. Values may be scalar values, collections, or objects that Scriban can expose through its normal member-access rules. Null or empty dictionaries are supported.
The optional partials dictionary also adds string-valued globals:
var snippets = new Dictionary<string, string>
{
["signature"] = "Thanks,\nSupport"
};
string result = await "{{ message }}\n\n{{ signature }}".Render(
new Dictionary<string, object?> { ["message"] = "Your export is ready." },
snippets);
These values are not registered with a Scriban ITemplateLoader; they are strings, not independently parsed include files. Keep keys unique across both dictionaries because globals are read-only once added.
Parsing and caching
Parsed templates are cached by exact template text for 30 seconds. Invalid syntax throws InvalidOperationException with Scriban's parse messages. Rendering errors propagate from Scriban. The method returns a ValueTask<string> because Scriban rendering can be asynchronous.
Security
Treat the template as executable input. Scriban expressions can traverse the objects supplied in replacements; do not render templates from untrusted users against privileged application objects. Supply narrow DTOs or scalar values, and encode or sanitize the rendered result for its destination. Rendering does not automatically provide HTML, SQL, shell, or URL escaping.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Scriban (>= 7.6.1)
- Soenneker.Dictionaries.Concurrent.AutoClearing (>= 11.0.121)
- Soenneker.Extensions.String (>= 11.0.837)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.337 | 75 | 12/3/2026 |
| 11.0.336 | 55 | 12/3/2026 |
| 11.0.335 | 55 | 12/2/2026 |
| 11.0.334 | 52 | 12/2/2026 |
| 11.0.333 | 52 | 12/2/2026 |
| 11.0.332 | 53 | 12/2/2026 |
| 11.0.331 | 50 | 12/2/2026 |
| 11.0.330 | 60 | 12/2/2026 |
| 11.0.329 | 60 | 12/2/2026 |
| 11.0.328 | 55 | 12/2/2026 |
| 11.0.327 | 56 | 12/2/2026 |
| 11.0.326 | 69 | 12/1/2026 |
| 11.0.325 | 63 | 12/1/2026 |
| 11.0.324 | 62 | 12/1/2026 |
| 11.0.323 | 57 | 12/1/2026 |
| 11.0.322 | 106 | 11/30/2026 |
| 11.0.320 | 100 | 11/29/2026 |
| 11.0.319 | 218 | 11/18/2026 |
| 11.0.318 | 105 | 11/18/2026 |
| 11.0.317 | 96 | 11/18/2026 |
Update dependency Soenneker.Extensions.String to 11.0.837 (#717)