pub fn highlight_code_to_segments(
code: &str,
language: Option<&str>,
theme_name: &str,
) -> Vec<(Style, String)>Expand description
Highlight code and return styled segments
§Arguments
code- Source code to highlightlanguage- Optional language hint (auto-detected if None)theme_name- Syntax theme name (useget_active_syntax_theme()for UI theme sync)
§Returns
Vector of (Style, String) tuples for rendering
§Performance
- Returns None early if input exceeds guardrails
- Uses cached theme when available