diff options
Diffstat (limited to '')
-rw-r--r-- | book/src/filters.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/book/src/filters.md b/book/src/filters.md index bbeb5b8..d00d778 100644 --- a/book/src/filters.md +++ b/book/src/filters.md @@ -73,6 +73,28 @@ Output: Escape <>& ``` +Optionally, it is possible to specify and override which escaper is used. Consider a template where the escaper is configured as [`escape = "none"`]. However, somewhere escaping using the HTML escaper is desired. Then it is possible to override and use the HTML escaper like this: + +```jinja +{{ "Don't Escape <>&"|escape }} +{{ "Don't Escape <>&"|e }} + +{{ "Escape <>&"|escape("html") }} +{{ "Escape <>&"|e("html") }} +``` + +Output: + +```text +Don't Escape <>& +Don't Escape <>& + +Escape <>& +Escape <>& +``` + +[`escape = "none"`]: creating_templates.html#the-template-attribute + ### filesizeformat Returns adequate string representation (in KB, ..) of number of bytes: |