ASTTemplateParser 4.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ASTTemplateParser --version 4.0.0
                    
NuGet\Install-Package ASTTemplateParser -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ASTTemplateParser" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ASTTemplateParser" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ASTTemplateParser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ASTTemplateParser --version 4.0.0
                    
#r "nuget: ASTTemplateParser, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ASTTemplateParser@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ASTTemplateParser&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ASTTemplateParser&version=4.0.0
                    
Install as a Cake Tool

AST Template Parser

NuGet License

A high-performance, security-hardened template parser for .NET Framework 4.8 with HTML-like syntax.

✨ Features

  • 🚀 High Performance - 7,000+ renders/second, compiled property accessors
  • 🔒 Enterprise Security - XSS, SQL injection, code injection protection
  • 🧩 Component System - Reusable components with parameters and slots
  • 📐 Layout System - Master layouts with sections
  • 🎯 ASP.NET MVC 5 - Full integration with controllers and HtmlHelpers
  • 📝 HTML-like Syntax - No @ directives, pure HTML tags

📦 Installation

Install-Package ASTTemplateParser

Or via .NET CLI:

dotnet add package ASTTemplateParser

🚀 Quick Start

using ASTTemplateParser;

var engine = new TemplateEngine();
engine.SetVariable("UserName", "John");
engine.SetVariable("Products", productList);

var template = @"
<Element template=""page"">
    <h1>Welcome, {{UserName}}!</h1>
    <ForEach var=""p"" in=""Products"">
        <p>{{p.Name}} - ${{p.Price}}</p>
    </ForEach>
</Element>";

string html = engine.Render(template);

📖 Syntax Overview

Variables

{{UserName}}
{{Order.Customer.Name}}

Conditionals

<If condition="IsLoggedIn">
    <p>Welcome back!</p>
<ElseIf condition="IsGuest">
    <p>Hello Guest!</p>
<Else>
    <p>Please login</p>
</If>

Loops

<ForEach var="item" in="Items">
    <li>{{item.Name}}</li>
</ForEach>

Components

<Include component="element/button">
    <Param name="text" value="Click Me" />
    <Param name="type" value="primary" />
</Include>

🔧 ASP.NET MVC 5

// Global.asax
MvcIntegration.Initialize();

// Controller
public class HomeController : TemplateController
{
    public ActionResult Index()
    {
        return Template(new { Title = "Home" });
    }
}

// Razor View
@Html.Button("Click", "/action", "primary")
@Html.RenderComponent("block/card", new { title = "Card" })

🔒 Security

  • ✅ HTML encoding by default (XSS protection)
  • ✅ Expression validation (code injection protection)
  • ✅ Path traversal prevention
  • ✅ Loop iteration limits (DoS protection)
  • ✅ Blocked sensitive properties (Password, Token, etc.)

📊 Performance

Template Size Throughput
Small (1KB) ~7,000 ops/sec
Medium (4KB) ~1,600 ops/sec
Large (8KB) ~800 ops/sec

📄 License

MIT License - See LICENSE for details.

📚 Documentation

See DOCUMENTATION.md for complete API reference.

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.1.3 25 3/11/2026
2.1.2 37 3/10/2026
2.1.1 98 3/2/2026
2.1.0 83 2/28/2026
2.0.9 86 2/28/2026
2.0.8 101 2/15/2026
2.0.7 99 2/10/2026
2.0.6 110 2/10/2026
2.0.5 92 2/9/2026
2.0.4 94 2/9/2026
2.0.3 96 1/21/2026
2.0.2 91 1/20/2026
2.0.0 102 1/20/2026
1.0.45 106 1/19/2026
1.0.43 96 1/19/2026
1.0.42 92 1/19/2026
1.0.41 94 1/19/2026
1.0.40 97 1/19/2026
1.0.39 105 1/17/2026
Loading failed

v4.0.0 - Major Release
- Component System with Include/Param tags
- Layout System with RenderSection/RenderBody
- Slot System for component content injection
- ASP.NET MVC 5 Integration (TemplateController, HtmlHelper extensions)
- Enterprise-grade Security (XSS, SQL injection, code injection protection)
- High Performance (7,000+ ops/sec for small templates)
- HTML Comment handling (prevents recursion in component docs)