title: Auto formating of a .liquid-file (a Shopify theme file)
body: <p>I'm editting some 3rd-party code (a Shopify theme) and the code is absolutely unreadable. </p>
  
  <p>Ideally, I would like to be able to auto format <code>.liquid</code>-files, but can't seem to be able to. </p>
  
  <p><strong>My attempt in PhpStorm</strong></p>
  
  <p>I've tried inserting the code in PhpStorm and pressing <code>CMD + Option + l</code> (<a href="https://stackoverflow.com/a/29337624">after doing this</a>), which does something, but makes newlines in random places, like this:</p>
  
  <pre><code>{% unless current_tags %}&lt;h1
  class="text-center text-uppercase title-under"&gt;{{ 'blogs.general.title_main' | t }}&lt;/h1&gt;{% else %}&lt;h1
  </code></pre>
  
  <p><strong>My Attempt in Atom</strong></p>
  
  <p>In Atom I tried installing <a href="https://atom.io/packages/atom-beautify" rel="noreferrer">atom-beautify</a>, but that didn't recognize the file-type. I can see that <a href="https://github.com/Glavin001/atom-beautify/issues/393" rel="noreferrer">others have had my issue as well</a>. Since <code>.liquid</code> share quite a lot with <code>.blade.php</code>, then I tried to see if there was a solution for that format, which resulted in an <a href="https://github.com/Glavin001/atom-beautify/issues/448" rel="noreferrer">open thread as well</a>. </p>
  
  <p>I tried looking into <a href="https://github.com/Glavin001/atom-beautify/blob/master/docs/add-languages-and-beautifiers.md#how-to-add-a-language" rel="noreferrer">adding support for a new language</a> (with atom-beautify), but it got quite time-consuming fast. </p>
  
  <p><strong>My attempt with <a href="http://prettydiff.com/" rel="noreferrer">PrettyDiff.com</a></strong></p>
  
  <p>This got kinda close. But it's still a hassle, if I have an entire Shopify-theme, to copy the code into that website, before moving it to my editor. If PrettyDiff could absolutely <strong>nail</strong> the auto formatting, then I might have lived with it, - but it still does something like this:</p>
  
  <pre><code>{% if settings.show_blog_sidebar %}
    &lt;div class="col-xl-8 col-lg-8 col-md-12" id="centerColumn"&gt;
      {% endif %}
  </code></pre>
  
  <p><strong>What I would like to achieve</strong></p>
  
  <p>To make this crap:</p>
  
  <pre><code>{% unless current_tags %}&lt;h1
  class="text-center text-uppercase title-under"&gt;{{ 'blogs.general.title_main' | t }}&lt;/h1&gt;{% else %}&lt;h1
  class="text-center text-uppercase title-under"&gt;{{ 'blogs.general.title_result' | t }} {{ current_tags.first | replace: '-', ' ' }}&lt;/h1&gt;{% endunless %}
      {% for article in blog.articles %}{% if article.excerpt contains "SOMEVAR" %}&lt;p&gt;
      test&lt;/p&gt;{% capture _article %}{% include "get-content-with-key" content: article.excerpt key: "[SOMEVAR]" %}{% endcapture %}{% capture _title %}{% include "get-content-with-key" content: _article key: "[title]" %}{% endcapture %}{% capture author %}{% include "get-content-with-key" content: _article key: "[author]" %}{% endcapture %}{% capture image %}{% include "get-content-with-key" content: _article key: "[image]" %}{% endcapture %}{% capture content %}{% include "get-content-with-key" content: _article key: "[content]" %}{% endcapture %}{% if _title == '' %}{% assign _title = article.title %}{% endif %}{% if author == '' %}{% assign author = article.author %}{% endif %}
      {% if article.comments.size &gt; 0 %}{% assign comment_url = article.url | append: '#comments' %}{% else %}{% assign comment_url = article.url | append: '#addcomment' %}{% endif %}
          &lt;div class="{{ grid }}"&gt;
          ...
          ...
  </code></pre>
  
  <p>Look like this:</p>
  
  <pre><code>{% unless current_tags %}
    &lt;h1 class="text-center text-uppercase title-under"&gt;{{ 'blogs.general.title_main' | t }}&lt;/h1&gt;
  {% else %}
    &lt;h1 class="text-center text-uppercase title-under"&gt;{{ 'blogs.general.title_result' | t }} {{ current_tags.first | replace: '-', ' ' }}&lt;/h1&gt;
  {% endunless %}
  
  {% for article in blog.articles %}
    {% if article.excerpt contains "SOMEVAR" %}
      &lt;p&gt;test&lt;/p&gt;
      {% capture _article %}
        {% include "get-content-with-key" content: article.excerpt key: "[SOMEVAR]" %}
      {% endcapture %}
      {% capture _title %}
        {% include "get-content-with-key" content: _article key: "[title]" %}
      {% endcapture %}
      {% capture author %}
        {% include "get-content-with-key" content: _article key: "[author]" %}
      {% endcapture %}
      {% capture image %}
        {% include "get-content-with-key" content: _article key: "[image]" %}
      {% endcapture %}
      {% capture content %}
        {% include "get-content-with-key" content: _article key: "[content]" %}
      {% endcapture %}
      {% if _title == '' %}
        {% assign _title = article.title %}
      {% endif %}
  
      {% if author == '' %}
        {% assign author = article.author %}
      {% endif %}
  
      {% if article.comments.size &gt; 0 %}
        {% assign comment_url = article.url | append: '#comments' %}
      {% else %}
        {% assign comment_url = article.url | append: '#addcomment' %}
      {% endif %}
        &lt;div class="{{ grid }}"&gt;
              ...
              ...
  </code></pre>
  
  <p>Am I really the first human being on this planet who would like to auto format a <code>.liquid</code>-file? </p>