duck.html

Subpackages

Package Contents

Functions

escape

Escapes HTML special characters in the input string to prevent injection attacks and broken markup.

API

duck.html.escape(content: str) str[source]

Escapes HTML special characters in the input string to prevent injection attacks and broken markup.

The following replacements are made: & -> & < -> < > -> > “ -> “ ’ -> ‘

Parameters:

content – Raw string to escape.

Returns:

Escaped HTML-safe string.

Return type:

str