[−][src]Function ansi_to_html::convert_escaped
pub fn convert_escaped(ansi_string: &str) -> Result<String, Error>
Converts a string containing ANSI escape codes to HTML.
Special html characters (<>&'"
) are escaped prior to the conversion.
This function attempts to minimize the number of generated HTML tags.
Example
// \x1b[1m : bold \x1b[31m : red let input = "<h1> \x1b[1m Hello \x1b[31m world! </h1>"; let converted = ansi_to_html::convert_escaped(input).unwrap(); assert_eq!( converted.as_str(), "<h1> <b> Hello <span style='color:#a00'> world! </h1></span></b>" );