You write a template in the upper left box and the data in the bottom left box. The data gets merged with the template and is shown on the right side. You can press Ctrl-P or tell your browser to print and only the output will be printed. The other parts of the page will dissappear.
You can write the template in Markdown or HTML, or you can mix both.
To apply the variables defined in the data box (see below), use the {{ variable_name }}
syntax. For more advanced usage, you can check the Nunjucks documentation, as that's the library used underneath. There are many pre-built filters, variable modifiers and other niceties you can use.
Data is the place where you define the variables used in the templates. You can write it in the YAMLformat, a superset of JSON that's easier to write (basically you just do key: value
with your desired key and value for that key.
To facilitate the printing of multiple repeated documents with small changes in data between each one (for example, a more-or-less equal document that must be printed with the names of different people, or with multiple different dates), there's the special key loop
.
loop
expects a list of data groups consisting of keys and values. For each group on that list, a repeated version of the template will be generated. You write a single template and it can access, through the {{ varname }}
syntax, both the top-level data and the loop data.
Loops operate much like the for
context of Nunjucks and has access to its special loop.
variables too.