> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kiwify.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# HTML filters

> HTML filters for working with HTML and URI content in Liquid templates.

## `escape`

Escapes a string by replacing HTML special characters with escape sequences. It doesn't change strings that don't have anything to escape.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Have you read 'James & the Giant Peach'?" | escape }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Have you read &#39;James &amp; the Giant Peach&#39;?
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Tetsuro Takara" | escape }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Tetsuro Takara
    ```
  </CodeGroup>
</Columns>

## `escape_once`

Escapes a string without changing existing escaped entities. It doesn't change strings that don't have anything to escape.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "1 < 2 & 3" | escape_once }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    1 &lt; 2 &amp; 3
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    &#x7B;&#x7B; "{{"1 &lt; 2 &amp; 3" | escape}}" | escape_once }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    1 &lt; 2 &amp; 3
    ```
  </CodeGroup>
</Columns>

## `strip_html`

Removes any HTML tags from a string.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Have <em>you</em> read <strong>Ulysses</strong>?" | strip_html }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Have you read Ulysses?
    ```
  </CodeGroup>
</Columns>

## `newline_to_br`

Replaces every newline (`\n`) in a string with an HTML line break (\`\`).

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% capture string_with_newlines %}
    Hello
    there
    {% endcapture %}

    {{ string_with_newlines | newline_to_br }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    <br/>Hello<br/>there<br/>
    ```
  </CodeGroup>
</Columns>

## `url_encode`

Converts any URL-unsafe characters in a string into percent-encoded characters.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "john@liquid.com" | url_encode }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    john%40liquid.com
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Tetsuro Takara" | url_encode }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Tetsuro+Takara
    ```
  </CodeGroup>
</Columns>

## `url_decode`

Decodes a string that has been encoded as a URL.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "%27Stop%21%27+said+Fred" | url_decode }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    'Stop!' said Fred
    ```
  </CodeGroup>
</Columns>

## `xml_escape`

Escape some text for use in XML.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Have you read \'James & the Giant Peach\'?" | xml_escape }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Have you read &#39;James &amp; the Giant Peach&#39;?
    ```
  </CodeGroup>
</Columns>

## `cgi_escape`

CGI escape a string for use in a URL. Replaces any special characters with appropriate `%XX` replacements. CGI escape normally replaces a space with a plus `+` sign.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "foo, bar; baz?" | cgi_escape }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    foo%2C+bar%3B+baz%3F
    ```
  </CodeGroup>
</Columns>

## `uri_escape`

Percent encodes any special characters in a URI. URI escape normally replaces a space with `%20`. Reserved characters will not be escaped.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "https://example.com/?q=foo, \bar?" | uri_escape }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    https://example.com/?q=foo,%20%5Cbar?
    ```
  </CodeGroup>
</Columns>

## `slugify`

Convert a string into a lowercase URL "slug". The slugify filter accepts 2 options:

1. `mode: string`. The default is `"default"`. They are as follows (with what they filter):

* `"none"`: no characters
* `"raw"`: spaces
* `"default"`: spaces and non-alphanumeric characters
* `"pretty"`: spaces and non-alphanumeric characters except for `._~!$&'()+,;=@`
* `"ascii"`: spaces, non-alphanumeric, and non-ASCII characters
* `"latin"`: like default, except Latin characters are first transliterated (e.g. àèïòü to aeiou).

2. `case: boolean`. The default is `false`. The original case of slug will be retained if set to `true`.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "The _config.yml file" | slugify }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    the-config-yml-file
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "The _config.yml file" | slugify: "pretty" }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    the-_config.yml-file
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "The _cönfig.yml file" | slugify: "ascii" }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    the-c-nfig-yml-file
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "The cönfig.yml file" | slugify: "latin" }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    the-config-yml-file
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "The cönfig.yml file" | slugify: "latin", true }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    The-config-yml-file
    ```
  </CodeGroup>
</Columns>
