From 95580b0eb3aa210f0af6a06db75da17fdf8e7cd5 Mon Sep 17 00:00:00 2001 From: Jun Yang Date: Tue, 27 Dec 2016 00:08:16 +0800 Subject: [PATCH] Created Whitespace Control (markdown) --- Whitespace-Control.md | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Whitespace-Control.md 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