Skip to main content

mark_safe

Explicitly mark a string as safe for (HTML) output purposes. The returned object can be used everywhere a string is appropriate.

If used on a method as a decorator, mark the returned data as safe.

Can be called multiple times on a single string.
def mark_safe(
s: Any
) - > SafeString

Explicitly mark a string as safe for (HTML) output purposes. The returned object can be used everywhere a string is appropriate.

Parameters

NameTypeDescription
sAnyThe string, lazy object, or callable to be marked as safe for HTML output.

Returns

TypeDescription
SafeStringA string-like object that is flagged as safe for HTML rendering, preventing further auto-escaping.