Morestachio
Lightweight, powerful, flavorful, template engine.
Install / Use
/learn @JPVenson/MorestachioREADME
Morestachio

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 />
|
|
| The base Morestachio lib |
| Morestachio.Linq <br />
<br />
| |
| Linq formatter |
| Morestachio.Runner <br />
<br />
| |
| An executable interface for invoking a Morestachio Template |
| Morestachio.Newtonsoft.Json <br />
<br />
| |
| Newtonsoft Json types support |
| Morestachio.System.Text.Json <br />
<br />
| |
| System.Text Json types support |
| Morestachio.System.Xml.Linq <br />
<br />
| |
| XDocument types support |
| Morestachio.Extensions.Logging <br />
<br />
| |
| 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.
- each object can be formatted by adding formatter to morestachio
- 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.
- Its Lightning fast. Even unreasonably huge templates that contain >5000 instructions can be executed in around 0.5 secounds
- Morestachio accepts any object as source
- Cancellation of Template generation is supported
- Async calls are supported (For Formatters)
- No External Depedencies for Morestachio.dll.
- Support for sever
Related Skills
node-connect
349.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.7kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
