vscode-liquid
vscode-liquid copied to clipboard
Inline JSON gets messed up
Hi,
I love this extension and to the most part it works pretty well. It does however mess up when you have inline schema data like this:
{% if template.name == 'index' %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "{{ shop.name }}",
"potentialAction": {
"@type": "SearchAction",
"target": "{{ shop.url }}/search?q={search_term_string}",
"query-input": "required name=search_term_string"
},
"url": "{{ shop.url }}{{ page.url }}"
}
</script>
{% endif %}
as it is converted to this:
<script type="application/ld+json">
[36mLine: 1[0m
[31m[36 mLine : 1 [[0m
[31m 0 m [[0m
[31m 31 m[[0m
[31m 36 mLine : 2 [[0m
[31m [[0m
[31m 0 m [[0m
[31m 31 m 0 m [[0m
</script>
{% if template.name == 'index' %}
<script type="application/ld+json">
[36mLine: 2[0m
[31m(empty line)[0m
[31m(empty line)[0m
[31m[36mLine: 1[0m[0m
[31m[31m[36 mLine : 1 [[0m[0m
[31m[31m 0 m [[0m[0m
[31m[31m 31 m {[0m[0m
[31m[31m [[0m[0m
</script>
{% endif %}
I've already verified that I don't have the other Liquid extensions known to cause issues, and I also have Prettier disabled on this test.
Any way I can get around this?
Hey @lmartins this is known issue that will be fixed in the next version release. A quick workaround for now until it is addressed is to do something like this:
{% assign attr = 'type="application/ld+json"' %}
<script {{ attr }}>
{
"name": "foo",
"settings": [
{
"type": "something"
}
]
}
</script>
@panoply Thanks so much for the fast reply.
Any updates on a fix for this?
Coming. Sit tight.
How to config to not format this part?
Hi there! Just wanted to check - are there any new solutions to this? Thank you!
Coming. Sit tight.
Almost end of 2021 and no fix
🚢 Shipped v3.0.0