escape_link

Convert any URLs in a plaintext into HTML links, with adding the rel="nofollow" attribute, and replaces all newlines with <br> tags.

Example:

{{ "Hello http://foo.bar/\n\nAnd bye."|escape_link }}

Outputs:

"Hello <a href="http://foo.bar/" rel="noopener nofollow noreferrer">http://foo.bar/</a><br /><br />And bye."

This filter is very useful when displaying user-generated plaintexts, like comments.

Edit on GitHub

escape_ical Character escaping escapejs

urlize URLs and links urlencode

Referred by

Filters

Filters transform template variables before they are rendered.

urlize

Find urls in the given input and make them clickable.