Skip to main content

highlight

Function highlight 

Source
pub fn highlight(code: &str, language: &str, theme: &str) -> Result<String>
Expand description

Highlight a code string with syntax highlighting, producing an ANSI-coloured String suitable for terminal output.

If language is empty or unrecognised, falls back to plain text. If theme is empty, uses the built-in base16-ocean.dark theme.