diff options
author | mbuscemi <matthew.buscemi@gmail.com> | 2021-03-22 03:59:17 -0700 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-03-22 13:23:08 +0100 |
commit | 4ca966178c63bac1b6a803f2dc74bd43f27dcf24 (patch) | |
tree | 1846f13482ed38b2da84417c5f0491b3088d0c86 /book | |
parent | e018c4a4273063989041c1dc1b6c6878d03a56a6 (diff) | |
download | askama-4ca966178c63bac1b6a803f2dc74bd43f27dcf24.tar.gz askama-4ca966178c63bac1b6a803f2dc74bd43f27dcf24.tar.bz2 askama-4ca966178c63bac1b6a803f2dc74bd43f27dcf24.zip |
updated the book to describe the new paragraphbreaks filter
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. |