Skip to main content

highlight

Function highlight 

Source
pub fn highlight(lang: Option<&str>, text: &str) -> Vec<Span>
Expand description

Highlights text as lang (a name, alias or extension; see Lang::from_name).

The spans are ordered, non-overlapping, non-empty, on char boundaries and cover the whole input; neighbours never share a kind. An unknown or missing language gives one Kind::Plain span. Runs in time linear in the input and never panics.