• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use owo_colors::Style;
2 
3 use crate::SpanContents;
4 
5 use super::{Highlighter, HighlighterState};
6 
7 /// The default syntax highlighter. It applies `Style::default()` to input text.
8 /// This is used by default when no syntax highlighting features are enabled.
9 #[derive(Debug, Clone)]
10 pub struct BlankHighlighter;
11 
12 impl Highlighter for BlankHighlighter {
start_highlighter_state<'h>( &'h self, _source: &dyn SpanContents<'_>, ) -> Box<dyn super::HighlighterState + 'h>13     fn start_highlighter_state<'h>(
14         &'h self,
15         _source: &dyn SpanContents<'_>,
16     ) -> Box<dyn super::HighlighterState + 'h> {
17         Box::new(BlankHighlighterState)
18     }
19 }
20 
21 impl Default for BlankHighlighter {
default() -> Self22     fn default() -> Self {
23         BlankHighlighter
24     }
25 }
26 
27 /// The default highlighter state. It applies `Style::default()` to input text.
28 /// This is used by default when no syntax highlighting features are enabled.
29 #[derive(Debug, Clone)]
30 pub struct BlankHighlighterState;
31 
32 impl HighlighterState for BlankHighlighterState {
highlight_line<'s>(&mut self, line: &'s str) -> Vec<owo_colors::Styled<&'s str>>33     fn highlight_line<'s>(&mut self, line: &'s str) -> Vec<owo_colors::Styled<&'s str>> {
34         vec![Style::default().style(line)]
35     }
36 }
37