9

I know that it's possible to escape HTML in liquid by using the escape filter

# cthulhu is "<blink>blink</blink>"

{{ cthulhu || escape }}

but is it possible to make liquid escape the HTML in all variables by default?

I know that Rails escapes all HTML by default, but I have to use html_safe because otherwise all the HTML within the liquid template is escaped.

I only found this issue on GitHub, which told the OP to just ask on Stack Overflow.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • This still seems to be an issue in 2022. There is a ["new" open issue](https://github.com/Shopify/liquid/issues/1240) which unfortunately has no answers or solutions. – Fabian Winkler Jun 02 '22 at 12:55

0 Answers0