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