From b95b18ff60bddb06e7d4b8958b971311976f0f3c Mon Sep 17 00:00:00 2001 From: David Jennes Date: Thu, 28 Jul 2022 18:24:10 +0200 Subject: [PATCH] Try to document this (afaik) --- docs/templates.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/templates.rst b/docs/templates.rst index 4708328..d325635 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -97,6 +97,17 @@ To comment out part of your template, you can use the following syntax: .. _template-inheritance: +Whitespace Control +------------------ + +Stencil supports the same syntax as Jinja for whitespace control, see [their docs for more information](https://jinja.palletsprojects.com/en/3.1.x/templates/#whitespace-control). + +Essentially, Stencil will **not** trim whitespace by default. However you can: + +- Control how this is handled for the whole template by setting the trim behaviour. We provide a few pre-made combinations such as `nothing` (default), `smart` and `all`. More granular combinations are possible. +- You can disable this per-block using the `+` control character. For example `{{+ if … }}` to preserve whitespace before. +- You can force trimming per-block by using the `-` control character. For example `{{ if … -}}` to trim whitespace after. + Template inheritance --------------------