Created Whitespace Control (markdown)

Jun Yang
2016-12-27 00:08:16 +08:00
parent 3b20e0b9c3
commit 95580b0eb3
+46
@@ -0,0 +1,46 @@
Like other variants of Liquid, shopify-liquid supports whitespace control markups.
In addition, you can change the default behaviors during construction.
## via Markups
By default, all tags and output markups lines will generate a CR,
and whitespace if there's an indentation.
For example:
```liquid
{% assign author = "harttle" %}
{{ author }}
```
Outputs:
```
harttle
```
You can include hyphens in your tag syntax (`{{-`, `-}}`, `{%-`, `-%}`) to
strip whitespace from left or right. For example:
```liquid
{% assign author = "harttle" -%}
{{ author }}
```
Outputs
```
harttle
```
> In this case, the `-%}` strips the whitespace from the right side of the `assign` tag.
## via Options
[shopify-liquid][shopify-liquid] will **NOT** trim any whitespace by default.
By specifying `options.trim_left` or `options.trim_right`,
you can change this default behavior.
See: <https://github.com/harttle/shopify-liquid>
[shopify-liquid]: https://github.com/harttle/shopify-liquid