Skip to main content

Module sanitize

Module sanitize 

Source
Expand description

Text and links made safe to write to a terminal, which interprets the escape sequences an untrusted input can carry.

Functionsยง

lines
text for a message of several lines: the newlines are kept.
link
The OSC 8 target for a link, or None when the link must not be clickable: longer than 2,048 bytes, with a scheme other than http, https, mailto and file (so relative paths and javascript: are dropped), or a file: link to another host.
text
The text with every character a terminal could interpret or that disguises text removed: C0 and C1 controls, DEL, bidi marks, overrides and isolates, the zero-width space, the word joiner and the invisible format characters around it, the byte order mark and tag characters. A tab becomes spaces, the line and paragraph separators a space.