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

742 B

Filters

Filters are used to format the rendered contents.

Example:

message: <%= "foo\nbar" | dbg %>

Output:

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
<%= expression | filter %>
  • Apply filter only
<%- expression | filter %>

Built-In Filters

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