Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent escaping HTML tags inside variable #1490

Open
DanielStout5 opened this issue Nov 19, 2021 · 4 comments
Open

Prevent escaping HTML tags inside variable #1490

DanielStout5 opened this issue Nov 19, 2021 · 4 comments

Comments

@DanielStout5
Copy link

DanielStout5 commented Nov 19, 2021

We have HTML inside an order attribute we'd like to output in a Liquid template in Shopify - specifically it's in order.attributes.

Just doing e.g. {{ order.attributes.myHtmlVariable }} is escaped - e.g. it outputs < and >

How do we make Liquid output the variable without escaping? I've tried {% raw %} but that only disables the processing of Liquid tags themselves.

It's possible Shopify automatically encodes the contents of order.attributes - in that case, how can we unescape the HTML when outputting?

@csaundersz
Copy link

Also looking for unescape.

@csaundersz
Copy link

csaundersz commented Feb 25, 2022

Would Shopify take a PR to support unescape as a filter? Looks pretty straightforward to add to https://github.com/Shopify/liquid/blob/master/lib/liquid/standardfilters.rb from https://docs.ruby-lang.org/en/2.2.0/CGI/Util.html

@jason-engage
Copy link

unescape would be great! so easy to implement too

@diegovogel
Copy link

I'd love to have this as well. Is someone working on it?

In my case, in section settings I want to include some <span> elements in a richtext field to add some styling. I can use a textarea field instead, but then everything needs to be handwritten (bold, italics, links, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants