diff --git a/Whitespace-Control.md b/Whitespace-Control.md new file mode 100644 index 0000000..ae59e5e --- /dev/null +++ b/Whitespace-Control.md @@ -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: + +[shopify-liquid]: https://github.com/harttle/shopify-liquid \ No newline at end of file