htmlify#
- htmlify(string, reverse=False, tostring=False)[source]#
Convert a string to its HTML representation by converting unicode characters, characters that need to be escaped, and newlines. If reverse=True, will convert HTML to string. If tostring=True, will convert the bytestring back to Unicode.
Examples:
output = sc.htmlify('foo&\nbar') # Returns b'foo&<br>bar' output = sc.htmlify('föö&\nbar', tostring=True) # Returns 'föö& bar' output = sc.htmlify('foo&<br>bar', reverse=True) # Returns 'foo&\nbar'