# apply

> Run a section of output through filters.

`apply` renders its content, then runs the result through one or more filters.

page.kiln:

```kiln
{% apply upper|trim %}
	Hello, {{ name }}
{% endapply %}
```

Output:

```html
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](https://kilnlang.com/docs/filters/strings/#safe-markup).

page.kiln:

```kiln
{% apply replace("NAME", name) %}
	<p>Hello, NAME</p>
{% endapply %}
```

Output:

```html
<p>Hello, &lt;em&gt;Ada&lt;/em&gt;</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](https://kilnlang.com/docs/api/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.
