pub struct SyntectHighlighter;Expand description
Highlights with syntect: its default grammars, its default themes, and
upstream’s ansi_dark and ansi_light, which use the terminal’s own
palette. This is the highlighter Syntax and Markdown use unless given
another one.
Implementations§
Trait Implementations§
Source§impl Clone for SyntectHighlighter
impl Clone for SyntectHighlighter
Source§impl CodeHighlighter for SyntectHighlighter
impl CodeHighlighter for SyntectHighlighter
Source§fn token_style(&self, theme: &str, token: &str) -> Option<Style>
fn token_style(&self, theme: &str, token: &str) -> Option<Style>
Upstream’s ANSI_DARK/ANSI_LIGHT entry for the token; for a syntect
theme, its foreground (Text) or its comment scope style.
Source§fn highlight(
&self,
code: &str,
language: Option<&str>,
theme: &str,
) -> Result<HighlightedCode, HighlightError>
fn highlight( &self, code: &str, language: Option<&str>, theme: &str, ) -> Result<HighlightedCode, HighlightError>
Highlight
code. language is a name or file extension ("rust",
"rs"); None means plain text. theme is one of themes.Source§fn default_theme(&self) -> &str
fn default_theme(&self) -> &str
The theme used when none is chosen.
impl Copy for SyntectHighlighter
Source§impl Debug for SyntectHighlighter
impl Debug for SyntectHighlighter
Auto Trait Implementations§
impl Freeze for SyntectHighlighter
impl RefUnwindSafe for SyntectHighlighter
impl Send for SyntectHighlighter
impl Sync for SyntectHighlighter
impl Unpin for SyntectHighlighter
impl UnsafeUnpin for SyntectHighlighter
impl UnwindSafe for SyntectHighlighter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more