Security Features Home Extensions Ecosystem

A goal of the Kvarn web server is to be modular. It’s also designed to be fast. Therefore, some default tools are provided to give good performance. You can naturally write other tools with the same level of integration as the Kvarn-branded ones.

Kvarn’s templating engine works using a present extension to expand template names. The extension takes arguments of which templates to include (e.g. !> tmpl standard.html markdown.html). It reads those files in the templates/<template file>. templates/ is a sibling of the public directory.

This system also works for file types other than HTML. The same pattern of template files (preferably with the same extension as the file being templated) and present extensions works.

You can define templates (in e.g. templates/standard.html) using names inside brakets prepended by a dollar sign: $[template name]. Everything after the template name (a space or newline is required after) is part of that template.

In your document, include templates by writing their name in brackets the same was as described above. The text will be “copy and pasted” to override the template. These don’t have to have newlines or spaces after them.

The template definitions and usages can be indented. This allows formatting tools to run.


If you don’t want a template, but only brackets $[], you can escape. Just insert a backslash \ before: \​$[].

See /chute/#escaping on how to write the above in Markdown source. The same applies to this.

If you see an unwanted \ in the HTML, consider removing the escape. It shouldn’t be needed. See the section below for some exceptions.

Issues with square brackets $[]

See /chute/#issues-with-square-brackets and /chute/#escaping.


You can’t start a line with $[ (or just have whitespace before) (even when using escaping) in a template. This is due to how data is copied from templates.