diff options
Diffstat (limited to 'book')
-rw-r--r-- | book/src/filters.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/book/src/filters.md b/book/src/filters.md index 2dc27b5..bbeb5b8 100644 --- a/book/src/filters.md +++ b/book/src/filters.md @@ -162,6 +162,24 @@ Output: hello<br />world<br /><br />from<br />askama ``` +### paragraphbreaks + +A new line followed by a blank line becomes `<p>`, but, unlike `linebreaks`, single new lines are ignored and no `<br/>` tags are generated. + +Consecutive double line breaks will be reduced down to a single paragraph break. + +This is useful in contexts where changing single line breaks to line break tags would interfere with other HTML elements, such as lists and nested `<div>` tags. + +``` +{{ "hello\nworld\n\nfrom\n\n\n\naskama"|paragraphbreaks }} +``` + +Output: + +``` +<p>hello\nworld</p><p>from</p><p>askama</p> +``` + ### lower | lowercase Converts to lowercase. |