Function html2text::from_read_coloured

source ·
pub fn from_read_coloured<R, FMap>(
    input: R,
    width: usize,
    colour_map: FMap
) -> Result<String, Error>
where R: Read, FMap: Fn(&[RichAnnotation], &str) -> String,
Expand description

Reads HTML from input, and returns text wrapped to width columns. The text is returned as a Vec<TaggedLine<_>>; the annotations are vectors of RichAnnotation. The “outer” annotation comes first in the Vec.

The function colour_map is given a slice of RichAnnotation and should return a pair of static strings which should be inserted before/after a text span with that annotation; for example a string which sets text colour and a string which sets the colour back to the default.