SkillAgentSearch skills...

Morestachio

Lightweight, powerful, flavorful, template engine.

Install / Use

/learn @JPVenson/Morestachio
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Morestachio

FOSSA Status Converage tests

Icon

A Lightweight, powerful, flavorful, templating engine for C# and other .net-based languages. Its a fork of Mustachio.

Need help?

Need general help? open a Discussion
Found a bug? open a Bug

Installing Morestachio:

|Project Nuget|Github|Status|Description| |---|---|---|---| | Morestachio <br /> Nuget Morestachio | GitHub release (latest by date including pre-releases) | Build status Deployment Status| The base Morestachio lib | | Morestachio.Linq <br /> Nuget Morestachio Linq <br /> | | Build status Deployment Status | Linq formatter | | Morestachio.Runner <br /> Nuget Morestachio Runner <br /> | | Build status Deployment Status | An executable interface for invoking a Morestachio Template | | Morestachio.Newtonsoft.Json <br /> Nuget Morestachio Json <br /> | | Build status Deployment Status | Newtonsoft Json types support | | Morestachio.System.Text.Json <br /> Nuget Morestachio System.Text.Json <br /> | | Build status Deployment Status | System.Text Json types support | | Morestachio.System.Xml.Linq <br /> Nuget Morestachio.System.Xml.Linq <br /> | | Build status Deployment Status | XDocument types support | | Morestachio.Extensions.Logging <br /> Nuget Morestachio.Extensions.Logging <br /> | | Build status Deployment Status | Microsoft.Extensions.Logging.ILogger support |

What's this for?

Morestachio allows you to create simple text-based templates that are fast and safe to render. It is optimized for WebServers and offers a high degree of customization with its formatter syntax.

Morestachio Playground:

Try it out, without consequenses. The Morestachio online editor allows you to create templates within your browser: Editor

How to use Morestachio:

// Your template
var sourceTemplate = "Dear {{name}}, this is definitely a personalized note to you. Very truly yours, {{sender}}";

// Parse the template into the document tree. 
var document = await ParserOptionsBuilder
   .New() //creates a new builder that inherts all default values
   .WithTemplate(sourceTemplate) //sets the template for that builder
   .BuildAndParseAsync(); //Builds the template and calls ParseAsync() on the returned ParserOptions

// Create the values for the template model:
dynamic model = new ExpandoObject();
model.name = "John";
model.sender = "Sally";
// or with dictionarys
IDictionary model = new Dictionary<string, object>();
model["name"] = "John";
model["sender"] = "Sally";
//or with any other object
var model = new { name= "John", sender= "Sally" };

//create an object based renderer or a compiled renderer
//the renderer is reusable and ThreadSave
var renderer = document.CreateRenderer();

// Render the template with your model and get the result as a string
var content = renderer.RenderAndStringify(model); // Dear John, this is definitely a personalized note to you. Very truly yours, Sally
Key Features

Morestachio is build upon Mustachio and extends the mustachio syntax in a a lot of points.

  1. each object can be formatted by adding formatter to morestachio
  2. Templates will be parsed as streams and will create a new stream for its output. This is better when creating larger templates and best for web as you can also limit the length of the "to be" created template to a certain size and write the result ether directly to an output stream or the Disc.
  3. Its Lightning fast. Even unreasonably huge templates that contain >5000 instructions can be executed in around 0.5 secounds
  4. Morestachio accepts any object as source
  5. Cancellation of Template generation is supported
  6. Async calls are supported (For Formatters)
  7. No External Depedencies for Morestachio.dll.
  8. Support for sever

Related Skills

View on GitHub
GitHub Stars57
CategoryDevelopment
Updated1mo ago
Forks11

Languages

C#

Security Score

85/100

Audited on Mar 4, 2026

No findings