Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban
1.0.0.96
dotnet add package Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban --version 1.0.0.96
NuGet\Install-Package Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban -Version 1.0.0.96
<PackageReference Include="Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban" Version="1.0.0.96" />
<PackageVersion Include="Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban" Version="1.0.0.96" />
<PackageReference Include="Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban" />
paket add Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban --version 1.0.0.96
#r "nuget: Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban, 1.0.0.96"
#:package Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban@1.0.0.96
#addin nuget:?package=Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban&version=1.0.0.96
#tool nuget:?package=Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban&version=1.0.0.96
Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban
Scriban as the template engine of the notification
templates of the
Innovabit.DotNet.Interceptors suite.
The base package (...Notifications.Abstractions) ships a dependency-free renderer that
substitutes {{ Placeholder }} and nothing else. Install this one when the wording needs
logic — conditionals, loops, filters, includes — which is usually the case for an HTML
e-mail.
Install
dotnet add package Innovabit.DotNet.Interceptors.Notifications.Templating.Scriban
Usage
services.AddInterceptors()
.AddNotifications()
.AddScribanTemplates() // enables templating + swaps the engine
.AddTemplatesFromDirectory("Templates")
.AddEmail(o => { ... });
Templates/order-failed.Email.html:
<h1>{{ ExceptionType }}</h1>
<p>{{ ExceptionMessage | html.escape }}</p>
{{ if Exception.InnerException }}
<p>Caused by {{ Exception.InnerException.Message | html.escape }}</p>
{{ end }}
<ul>{{ for argument in Arguments }}<li>{{ argument }}</li>{{ end }}</ul>
<footer>{{ OccurredAt | date.to_string "%Y-%m-%d %H:%M" }} — {{ MachineName }}</footer>
Notes
- Members keep their .NET names (
{{ Exception.StackTrace }}), so a template reads the same under this engine and under the built-in one. SetUseScribanMemberNames = truefor Scriban's own snake_case convention ({{ exception.stack_trace }}), or supply aMemberRenamer. - Values are not escaped automatically: pipe them through
html.escapein HTML templates whenever they may carry markup. - An unknown variable renders empty. Set
StrictVariables = trueto fail loudly instead. - Parsed templates are cached, and a template that cannot be parsed or rendered raises a
NotificationTemplateException— which the dispatcher swallows, delivering the untemplated wording rather than losing the notification.
Part of
The Innovabit.DotNet.Interceptors suite —
github.com/Innovabit/dotnet-interceptors.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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 is compatible. 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. |
-
net10.0
- Innovabit.DotNet.Interceptors.Notifications.Abstractions (>= 1.0.0.96)
- Scriban (>= 7.4.0)
-
net8.0
- Innovabit.DotNet.Interceptors.Notifications.Abstractions (>= 1.0.0.96)
- Scriban (>= 7.4.0)
-
net9.0
- Innovabit.DotNet.Interceptors.Notifications.Abstractions (>= 1.0.0.96)
- Scriban (>= 7.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.