mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
Created Whitespace Control (markdown)
@@ -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
|
||||
Reference in New Issue
Block a user