Mustache Specification

repository·master·Indexed 19 days ago

https://github.com/mustache/spec

The formal standard for the Mustache templating language, defining normal usage, edge-case behaviors for parsers, and optional modules. Includes guidelines on Semantic Versioning (SemVer) for implementations and provides the specification in both YAML and JSON formats.

Tokens
420
Snippets
0
Records
3
Agent score
16%

What's inside mustache-spec

  1. Understand Mustache specification versioning

    master

    The Mustache specification follows Semantic Versioning (SemVer). When reporting compatibility, implementations SHOULD report the most recent major and minor version numbers.

    If your implementation supports optional modules, you SHOULD indicate this with a remark attached to the version number (e.g., vX.Y, including lambdas or vX.Y+λ).

    Note for Implementers: If your implementation does not support at least v1.0.0 of this spec, it is RECOMMENDED to refer to your library as "Mustache-like" or "Mustache-inspired" rather than a standard Mustache implementation.

  2. Identify and handle optional Mustache modules

    master

    The specification includes optional modules that are not part of the core language syntax. These are identified in the specs directory by files beginning with a tilde (~).

    Modules are considered optional if they:

    • Do not affect core syntax.
    • Do not significantly affect rendered output.
    • Concern implementation-specific features or data types not common to all target languages (e.g., the lambda module, which handles code-type data).

    Implementers are strongly encouraged to support any optional modules they are reasonably capable of supporting.

  3. Use JSON versions of the specification

    master

    While the source of truth is written in YAML (located in the specs directory), JSON versions are provided for easier consumption in environments without robust YAML tooling.

    Handling Tagged Data in JSON: Because JSON does not support YAML "tags" (used to denote special types like source code, particularly in the lambda module), the JSON versions inject a special key named __tag__ containing the name of the tag as its value. When consuming JSON specs, you must handle this __tag__ key to correctly identify special data types.