Skip to main content

highlight_code_to_line_segments

Function highlight_code_to_line_segments 

Source
pub fn highlight_code_to_line_segments(
    code: &str,
    language: Option<&str>,
    theme_name: &str,
) -> Vec<Vec<(Style, String)>>
Expand description

Highlight code and return styled segments per line.

Uses LinesWithEndings semantics by preserving an empty trailing line when the input ends with \n.