Some folks use the capture tag to solve the "conditionally wrapped" problem.
Example:
{% capture inner %}
<!-- block of html -->
{% endcapture %}
{% if is_link %}
<a>
{{ inner }}
</a>
{% else %}
{{ inner }}
{% endif %}
This is probably the safest way to solve this problem. But since the capture tag is whitespace: pre, it also means we won't reformat the insides of that tag.
With the <!-- white-space: normal --> comment, the {% capture %} tag will now be deemed normal and we'll reformat its insides properly.
Some folks use the
capture
tag to solve the "conditionally wrapped" problem.Example:
This is probably the safest way to solve this problem. But since the capture tag is
whitespace: pre
, it also means we won't reformat the insides of that tag.With the
<!-- white-space: normal -->
comment, the{% capture %}
tag will now be deemed normal and we'll reformat its insides properly.e.g.
Note:
<!-- whitespace: normal -->
,{% # whitespace: normal %}
,{% # white-space: normal %}
are all equivalent.