Mustache template render
mustache-template-render · version 1.0.0 · Developer tools · free, no key needed
Render a logic-less Mustache template (spec v1.4.2) with JSON data and inline partials; returns the exact text.
Use when you need to: render mustache template · fill a mustache template with json data · mustache template rendering with partials.
Decide before calling
Read the versioned contract and the supported scope below. Reuse mustache-template-render@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use mustache-template-render@1.0.0 for render mustache template. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- render mustache template
- fill a mustache template with json data
- mustache template rendering with partials
- substitute values into mustache placeholders
- expand mustache sections over a list
- render logic-less template exactly per the mustache spec
- mustache html escaping of variables
Not supported
- lambdas or any executable data
- template inheritance blocks and parents ({{$block}}, {{<parent}})
- dynamic partial names ({{>*name}})
- loading partials from files, URLs or a registry
- Handlebars helpers, conditions with operators, or Jinja syntax
- interpolating whole objects or arrays as text
Behavior
- Mustache specification v1.4.2 core modules: comments, set delimiters, interpolation, sections, inverted sections and partials, including standalone-line removal and partial indentation.
- Name resolution: "." is the top context; otherwise the first dotted part is found once by walking the context stack top to bottom over JSON objects (own keys only), and each later part is resolved only inside that result; a missing key or broken chain renders as empty and is falsey.
- Every truthy section value is pushed as the context (objects, strings, numbers and true alike); arrays render the section once per element with the element pushed; falsey is missing, null, false, 0, "" and the empty array (the spec's !!data rule).
- Interpolation: null and missing render as empty; strings verbatim; numbers by ECMAScript Number::toString (85, 1.21, 1e+21); booleans as true/false; an object or array is unsupported_input with details.reason non_scalar_interpolation.
- {{name}} escapes & < > " ' as & < > " '; {{{name}}} and {{&name}} do not escape.
- Partials come only from the optional partials map (own keys; omitted means no partials); a missing partial renders as empty; partials always parse with the default {{ }} delimiters.
- Syntax errors throw invalid_input with details {reason, partial, line, column}; {{$...}}, {{<...}} and {{>*...}} throw unsupported_input with reason unsupported_tag.
- Limits are checked before or during work and fail with limit_exceeded; output is byte-stable for identical input.
Input
template(string, required): max length 65536; Mustache template text (at most 65536 UTF-8 bytes).data(any JSON value, required): Any JSON value used as the root context (at most 262144 UTF-8 bytes as JSON, 32 levels deep).partials(object, optional): Optional map from partial name to template text. Omitted means no partials.
Output
text(string, required)
Limits
- max template bytes: 65536
- max partials: 32
- max tags: 10000
- max section depth: 32
- max data bytes: 262144
- max data depth: 32
- max render depth: 64
- max render steps: 200000
- max output bytes: 262144
- max indented partial bytes: 1048576
Example
Request input:
{
"template": "\"{{#foo}}{{.}} is {{foo}}{{/foo}}\"",
"data": {
"foo": "bar"
}
}
Response:
{
"result": {
"text": "\"bar is bar\""
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "mustache-template-render",
"version": "1.0.0",
"input": {
"template": "\"{{#foo}}{{.}} is {{foo}}{{/foo}}\"",
"data": {
"foo": "bar"
}
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/mustache-template-render/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"template":"\"{{#foo}}{{.}} is {{foo}}{{/foo}}\"","data":{"foo":"bar"}}'
The machine-readable contract is at /v1/tools/mustache-template-render/versions/1.0.0.
CLI
node cli.mjs run mustache-template-render 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Mustache variables list: List the names and partials a Mustache template references, with tag kind, line, column and enclosing sections.
- Mustache template validate: Check Mustache template syntax (spec v1.4.2) and its partials; returns valid or the first error with line and column.
- Editorconfig resolve: Resolve EditorConfig properties for one normalized relative POSIX path from caller-supplied file contents.
- Shell argv quote: Quote inert argv strings for POSIX sh or PowerShell 7, returning a command and its per-argument fragments.
- Git renames detect: Detect deterministic one-to-one Git-style rename pairs, unmatched paths, scores, and byte evidence.
- Chmod mode convert: Convert a Unix permission mode and apply explicit chmod symbolic clauses, returning canonical octal and symbolic forms.