SilverBullet uses a template language for [[Templates]] that is partially inspired by [Handlebars](https://handlebarsjs.com/), however adds some powerful new features — primarily a much more expressive [[Expression Language]].
The template language is a superset of [[Markdown]] text a new _directive syntax_ added, using `{{` and `}}`.
Examples on this page will use the [[Live Templates#Template]] feature. To see the underlying code, move your cursor inside the block or click the edit button that will appear when you hover over the block.
# Expressions
[[Expression Language]] expressions can be inject in a template using the `{{expression}}` syntax.
There’s some “smarts” built into this:
* When the expression evaluates to a scalar value, such as a string, number or boolean, this value will just be presented as is.
* When the expression evaluates to an _array of objects_ (such as the result of a query), they will be rendered as a markdown table.
* When the expression evaluates to a single simple object, this value will be rendered in a single-row markdown table.
* Any other complex value will be rendered as JSON.
## Examples
```template
A simple value: {{20 * 3}}
A list of objects:
{{{page limit 2}}}
Note that if we include a `render` clause in a query, it will evaluate to a string and therefore also render properly:
To define (scoped) variables, you can you use a `#let` directive. The variable will be scoped to the directive. Variables in [[Expression Language]] use the `@variable` syntax:
```template
{{#let @myVar = 3 * 3}}
3 * 3 from a variable: {{@myVar}}
{{/let}}
And here it is {{@myVar}} again
```
# if directive
To conditionally render a part of a template use an `#if` directive: