pub trait Highlighter {
// Required method
fn start_highlighter_state<'h>(
&'h self,
source: &dyn SpanContents<'_>,
) -> Box<dyn HighlighterState + 'h>;
}Expand description
A syntax highlighter for highlighting miette SourceCode snippets.
Required Methods§
Sourcefn start_highlighter_state<'h>(
&'h self,
source: &dyn SpanContents<'_>,
) -> Box<dyn HighlighterState + 'h>
fn start_highlighter_state<'h>( &'h self, source: &dyn SpanContents<'_>, ) -> Box<dyn HighlighterState + 'h>
Creates a new HighlighterState to begin parsing and highlighting
a SpanContents.
The GraphicalReportHandler will call
this method at the start of rendering a SpanContents.
The SpanContents is provided as input only so that the Highlighter
can detect language syntax and make other initialization decisions prior
to highlighting, but it is not intended that the Highlighter begin
highlighting at this point. The returned HighlighterState is
responsible for the actual rendering.