Skip to main content

highlight

Function highlight 

Source
pub fn highlight(code: &str, theme: &str) -> Text
Expand description

Highlight code as SQL with theme (one of THEMES; anything else is monokai), as a styled Text. Needs no Syntax, so it works in a build without syntect.

let text = rich_ext::sql::highlight("select 'x'", "ansi_light");
assert_eq!(text.spans().len(), 2);