Tags
apply
Run a section of output through filters.
apply renders its content, then runs the result through one or more filters.
page.kiln
{% apply upper|trim %}
Hello, {{ name }}
{% endapply %}
Output
HELLO, ADA
The content was escaped as it rendered. The built-in text filters, such as upper and replace, keep it safe and change only its text, so it isn't escaped twice. Text they add, such as a replacement, is escaped. See Safe markup.
page.kiln
{% apply replace("NAME", name) %}
<p>Hello, NAME</p>
{% endapply %}
Output
<p>Hello, <em>Ada</em></p>
A filter that returns a plain string, such as one of your own, has its result escaped like any other output. Return safe markup from it to keep the HTML. apply doesn't create a scope.
This site uses apply with its own filters to highlight every code example.