harttle/liquidjs

Indentation improvement

cdtut opened this issue · 0 comments

cdtut commented

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.