Closed charlespwd closed 9 months ago
The actual solution for this is to not quote swap ever. But I think that's a bit too picky for an edge-case. IMO JSON shouldn't be in a data-attribute but rather in a tag instead. It makes for nicer to look at HTML too.
<div data-json-id='json-id-1'></div>
<script id="json-id-1" type="application/json">
{{ json_object }}
</script>
<script>
// example access
const json = JSON.parse(document.getElementById('json-id-1'));
</script>
Describe the bug Quote swap on Liquid output is unsafe.
Unformatted source
Expected output
Actual output
Additional context The quote swap breaks the HTML parsing. I think we have to revert the quote swap if there's Liquid in the attribute. No way to know.