sailfish/docs/en/docs/syntax/filters.md

793 B

Filters

Filters are used to format the rendered contents.

Example:

=== "Template"

``` rhtml
message: <%\html "foo\nbar" | dbg %>
```

=== "Result"

``` html
message: &quot;foo\nbar&quot;
```

!!! Note Since dbg filter accepts <T: std::fmt::Debug> types, that type isn't required to implement Render trait. That means you can pass the type which doesn't implement Render trait.

Syntax

  • Apply filter and HTML escaping
<%\html expression | filter %>
  • Apply filter only
<%- expression | filter %>

Built-In Filters

Built-In filters can be found in sailfish::filter module.