Files
Cagire/crates/markdown/src/highlighter.rs

18 lines
486 B
Rust

//! Syntax highlighting trait for fenced code blocks in markdown.
use ratatui::style::Style;
/// Produce styled spans from a single line of source code.
pub trait CodeHighlighter {
fn highlight(&self, line: &str) -> Vec<(Style, String)>;
}
/// Pass-through highlighter that applies no styling.
pub struct NoHighlight;
impl CodeHighlighter for NoHighlight {
fn highlight(&self, line: &str) -> Vec<(Style, String)> {
vec![(Style::default(), line.to_string())]
}
}