Examples
Render Hello {{name}}: {{count}} files
Render Hello {{name}}: {{count}} files. The input is a small public learning fixture; it contains no private production data.
Input
{"name": "Ada", "count": 3}Expected answer
Hello Ada: 3 files- Template definition (.handlebars)
Hello {{name}}: {{count}} files
Render {{service}} listens on {{port}}
Render {{service}} listens on {{port}}. The input is a small public learning fixture; it contains no private production data.
Input
{"service": "api", "port": 443}Expected answer
api listens on 443- Template definition (.handlebars)
{{service}} listens on {{port}}
Render {{city}}: {{celsius}} C
Render {{city}}: {{celsius}} C. The input is a small public learning fixture; it contains no private production data.
Input
{"city": "Oslo", "celsius": -12}Expected answer
Oslo: -12 C- Template definition (.handlebars)
{{city}}: {{celsius}} C
Render Release {{version}}
Render Release {{version}}. The input is a small public learning fixture; it contains no private production data.
Input
{"version": "2.1.0"}Expected answer
Release 2.1.0- Template definition (.handlebars)
Release {{version}}
Render Job {{id}} is {{status}}
Render Job {{id}} is {{status}}. The input is a small public learning fixture; it contains no private production data.
Input
{"status": "ready", "id": 42}Expected answer
Job 42 is ready- Template definition (.handlebars)
Job {{id}} is {{status}}
Disallow XSS
Input
{"test": "<script></script>"}Expected answer
<script></script><script></script>- Template definition (.handlebars)
<script></script>{{ test }}
Partials
Input
{"users":[{"name":"Someone","age":25},{"name":"Someone Else","age":32}]}Expected answer
Name: Someone
Age: 25
Name: Someone Else
Age: 32
- Template definition (.handlebars)
{{#*inline "user"}} Name: {{ name }} Age: {{ age }} {{/inline}} {{#each users}} {{> user}} {{/each}}
Print Basic Variables
Input
{"one": 1, "two": 2}Expected answer
1 2- Template definition (.handlebars)
{{ one }} {{ two }}
Simple Print
Input
{}Expected answer
Hello, world!- Template definition (.handlebars)
Hello, world!
Format reference: Template background and specification