pub trait CodeHighlighter:
Send
+ Sync
+ 'static {
// Required method
fn highlight(&self, request: &HighlightRequest<'_>) -> Vec<HighlightSpan>;
// Provided method
fn languages(&self) -> Vec<String> { ... }
}Expand description
A code highlighting plugin. Results are cached per code block content, language and background.
Required Methods§
Sourcefn highlight(&self, request: &HighlightRequest<'_>) -> Vec<HighlightSpan>
fn highlight(&self, request: &HighlightRequest<'_>) -> Vec<HighlightSpan>
Colours for one code block. Return an empty list for unknown languages.
Provided Methods§
Sourcefn languages(&self) -> Vec<String>
fn languages(&self) -> Vec<String>
Language names offered in the toolbar’s language list. When empty,
the editor offers COMMON_LANGUAGES.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl CodeHighlighter for SyntectHighlighter
Available on crate feature
syntect only.