Skip to content

Commit

Permalink
minor #4447 Clarify documentation for escape filter (dmjohnsson23)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.x branch.

Discussion
----------

Clarify documentation for escape filter

It was somewhat unclear from the documentation what the intended purpose of the 'js' escape strategy is. I wasn't certain *where* exactly in JavaScript such strings were intended to be output. Someone (by that I mean me--though maybe I'm just an idiot...) might inadvertently think the filter was meant to be used somewhere in actual JavaScript code, rather than simply in strings.

Commits
-------

728b361 Clarify documentation for escape filter
  • Loading branch information
fabpot committed Nov 22, 2024
2 parents c8494b8 + 728b361 commit a4a11ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/filters/escape.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ documents:
* ``html``: escapes a string for the **HTML body** context,
or for HTML attributes values **inside quotes**.

* ``js``: escapes a string for the **JavaScript** context.
* ``js``: escapes a string for the **JavaScript** context. This is intended for
use in JavaScript or JSON strings, and encodes values using backslash escape
sequences.

* ``css``: escapes a string for the **CSS** context. CSS escaping can be
applied to any string being inserted into CSS and escapes everything except
Expand Down

0 comments on commit a4a11ca

Please sign in to comment.