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

Inline JSON gets messed up #38

Closed
lmartins opened this issue Oct 11, 2019 · 8 comments
Closed

Inline JSON gets messed up #38

lmartins opened this issue Oct 11, 2019 · 8 comments
Assignees
Labels
Bug Something isn't working in the vscode extension

Comments

@lmartins
Copy link

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?

@panoply
Copy link
Owner

panoply commented Oct 11, 2019

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 panoply added the Bug Something isn't working in the vscode extension label Oct 11, 2019
@panoply panoply added the 💧Liquify Features shipping in Liquify label Oct 11, 2019
@lmartins
Copy link
Author

@panoply Thanks so much for the fast reply.

@erin-dot-io
Copy link

Any updates on a fix for this?

@panoply
Copy link
Owner

panoply commented Jul 23, 2020

Coming. Sit tight.

@panoply panoply self-assigned this Aug 9, 2020
@panoply panoply added this to the Liquify milestone Aug 9, 2020
@keidarcy
Copy link

keidarcy commented Oct 1, 2020

How to config to not format this part?

@bigboydiamonds
Copy link

Hi there! Just wanted to check - are there any new solutions to this? Thank you!

@pinguluk
Copy link

pinguluk commented Dec 9, 2021

Coming. Sit tight.

Almost end of 2021 and no fix

@panoply panoply added v3.0.0 and removed 💧Liquify Features shipping in Liquify labels Sep 25, 2022
@panoply panoply removed this from the Liquify milestone Sep 25, 2022
@panoply
Copy link
Owner

panoply commented Sep 28, 2022

🚢 Shipped v3.0.0

@panoply panoply closed this as completed Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working in the vscode extension
Projects
None yet
Development

No branches or pull requests

6 participants