diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 7712015929..6b44e81611 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -655,6 +655,20 @@ escaping HTML. ((u.first_name, u.last_name) for u in users) ) +.. function:: json_script(value, element_id=None) + + Escapes all HTML/XML special characters with their Unicode escapes, so + value is safe for use with JavaScript. Also wraps the escaped JSON in a + ``' + + .. versionchanged:: 4.1 + + In older versions, the ``element_id`` argument was required. + .. function:: strip_tags(value) Tries to remove anything that looks like an HTML tag from the string, that