template element¶
Jinja2 template rendering to a container of child elements.
Fields¶
| Field | Type | Default | Description |
|---|---|---|---|
template |
string (optional) | null |
Inline Jinja2 template text rendering to a JSON5 array of elements. Best for short in-place generation (a loop emitting a grid); move anything reused or long to template_file. Author exactly one of template / template_file. |
template_file |
path (optional) | null |
Path to a *.elements.json.j2 Jinja2 template rendering to a JSON5 array of elements, relative to the file this element appears in. May declare its parameters in a JSON5 front-matter block (between --- lines). Author exactly one of template / template_file. |
with_ |
dict | null |
Every element also shares the common fields — position, size, anchor, opacity, scale, and angle.
Example¶
{
// Inline Jinja2 rendering to a JSON5 element array — a loop replaces
// hand-writing N near-identical elements. Reusable templates live in
// *.elements.json.j2 files referenced via template_file + with.
template: "[ {% for i in range(3) %} { markdown: \"Step {{ i + 1 }}\", position: [10, {{ 15 + i * 10 }}], width: 80 }, {% endfor %} ]",
position: [0, 0],
width: 100,
height: 100,
}