Skip to main content

highlight_code_to_segments

Function highlight_code_to_segments 

Source
pub fn highlight_code_to_segments(
    code: &str,
    language: Option<&str>,
    theme_name: &str,
) -> Vec<Vec<HighlightedSegment>>
Expand description

Highlight a code string and return styled segments per line.

This function applies syntax highlighting to the provided code and returns a vector of lines, where each line contains styled segments.