Code Execution in Templates
Pre-release
Pre-release
You can now execute code in templates. For example, {{{ 1 + 1 }}}
renders to 2. The code can also be contextual, so if you have a template variable of test: 100
, {{{ test += 1; test + 10 }}}
will render 111 (test
incremented by 1 to 101, test + 10
is rendered), but test
will be 101. The {{ test }}
notation is a pre-render, so the content is safely rendered before any potentially unsafe/destructive code execution, but for an in-line render of the most up-to-date value at the time of top-down render, {{{ test }}}
should be used instead. To escape, use {{\{ test }}}
. NOTE THAT THERE IS CURRENTLY VERY LITTLE SANDBOXING OF THIS EXECUTION, DO NOT EXECUTE UNSAFE CODE. Sandboxing features will be coming in a later release.