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

Formatter breaks content inside script tag #74

Closed
ads1029 opened this issue Aug 10, 2021 · 3 comments
Closed

Formatter breaks content inside script tag #74

ads1029 opened this issue Aug 10, 2021 · 3 comments

Comments

@ads1029
Copy link

ads1029 commented Aug 10, 2021

Hi, I am trying to format a .liquid which contains script tag, somehow the formatter would modify the content without good intent.
I searched all the internet and cant find myself an answer. Any idea would be appreciated, cheers!
This issue will be more likely to occur when you have more than one script tag in the file.

Before:

<script type="application/ld+json">
  {
    "@context": "http://schema.org",
    "@type": "Organization",
    "name": "{{ shop.name }}",
  {% if settings.logo %}
    "logo": "https:{{ settings.logo | img_url: '450x' }}",
  {% endif %}
  "sameAs": [
      "{{ settings.social_twitter_link }}",
      "{{ settings.social_facebook_link }}",
      "{{ settings.social_pinterest_link }}",
      "{{ settings.social_instagram_link }}",
      "{{ settings.social_tumblr_link }}",
      "{{ settings.social_snapchat_link }}",
      "{{ settings.social_youtube_link }}",
      "{{ settings.social_vimeo_link }}"
    ],
    "url": "{{ shop.url }}{{ page.url }}"
  }
</script>

After:

<script type="application/ld+json">

�[36mLine: 2�[0m
�[31m(empty line)�[0m
�[31m�[36mLine: 1�[0m�[0m
�[31m�[31m�[36 mLine : 2 �[�[0m�[0m
�[31m�[31m        0 m �[�[0m�[0m
�[31m�[31m            31 mundefined�[�[0m�[0m
�[31m�[31m                0 m �[�[0m�[0m
�[31m(empty line)�[0m
</script>
Screen.Recording.2021-08-10.at.3.15.44.pm.mov
@panoply
Copy link
Owner

panoply commented Aug 10, 2021

Hey,

Please always look in issues before submitting an issue. See the workaround here:
#38 (comment)

@entozoon
Copy link

Just a hot take, but I'm glad @ads1029 brought up the issue again, as it's devilling me real good too.
That previous issue was 2 years ago.. and version 3.0.0 said it would be released 2 months ago.. so yeah, you're doing wonderful work @panoply but we're eager for updates!

@panoply
Copy link
Owner

panoply commented Feb 5, 2022

Moving to #79

@panoply panoply closed this as completed Feb 5, 2022
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

3 participants