liquidjs icon indicating copy to clipboard operation
liquidjs copied to clipboard

Indentation improvement

Open cdtut opened this issue 2 years ago • 0 comments

To get proper indented output like this:

<div>
    1
    2
    3
</div>

You need to write:

<div>
    1
    {% for xxx %}
    {% if xxx %}
    2
    {% endif %}
    {% endfor %}
    {% if xxx %}
    3
    {% endif %}
</div>

This is better to read and organize:

<div>
    1
    {% for xxx %}
        {% if xxx %}
            2
        {% endif %}
    {% endfor %}
    {% if xxx %}
        3
    {% endif %}
</div>

But output is like this:

<div>
    1
            2
        3
</div>

If a tag is on its own line liquid should detect the starting indent level of the outer tag and put the inner content on same indent level.

cdtut avatar Nov 16 '23 00:11 cdtut