Skip to content

Instantly share code, notes, and snippets.

@FoxxMD

FoxxMD/mustache.md

Forked from Dammmien/mustache.md
Created Jun 4, 2021
Embed
What would you like to do?
Mustache cheatsheet

Basic tag

  Hello {{name}} !!

Comments

  {{! This is a comment, and it won't be rendered }}

Loop through a list of items

{{#list}}
  {{property}} // item.property
  or
  {{.}} // item
{{/list}}

Show a block if a variable is falsy, an empty list or a function returning a falsy value

{{^variable}}
  variable is a falsy or an empty list
{{/variable}}

Show a block if a variable is truthy or a function returning a truthy value

{{#variable}}
  variable is truthy
{{/variable}}

Import / include another template

{{> header}}

Render unescaped HTML

{{{<span>unescaped</span>}}} or {{&<span>unescaped</span>}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment