pub struct SyntaxHighlighter { /* private fields */ }Expand description
Syntax highlighting for code blocks using syntect.
This module provides syntax highlighting functionality for code blocks in markdown documents using the syntect library. Highlighter for code blocks using syntect.
Implementations§
Source§impl SyntaxHighlighter
Default constructor for SyntaxHighlighter.
impl SyntaxHighlighter
Default constructor for SyntaxHighlighter.
Sourcepub fn new() -> SyntaxHighlighter
Available on crate feature markdown-preview only.
pub fn new() -> SyntaxHighlighter
markdown-preview only.Create a new syntax highlighter with default dark theme.
Source§impl SyntaxHighlighter
Custom theme constructor for SyntaxHighlighter.
impl SyntaxHighlighter
Custom theme constructor for SyntaxHighlighter.
Sourcepub fn with_custom_theme(theme: Theme) -> SyntaxHighlighter
Available on crate feature markdown-preview only.
pub fn with_custom_theme(theme: Theme) -> SyntaxHighlighter
markdown-preview only.Create a new syntax highlighter with custom theme.
Source§impl SyntaxHighlighter
Dark theme constructor for SyntaxHighlighter.
impl SyntaxHighlighter
Dark theme constructor for SyntaxHighlighter.
Sourcepub fn with_dark_theme() -> SyntaxHighlighter
Available on crate feature markdown-preview only.
pub fn with_dark_theme() -> SyntaxHighlighter
markdown-preview only.Create a new syntax highlighter with dark theme.
Source§impl SyntaxHighlighter
Light theme constructor for SyntaxHighlighter.
impl SyntaxHighlighter
Light theme constructor for SyntaxHighlighter.
Sourcepub fn with_light_theme() -> SyntaxHighlighter
Available on crate feature markdown-preview only.
pub fn with_light_theme() -> SyntaxHighlighter
markdown-preview only.Create a new syntax highlighter with GitHub Light theme.
Source§impl SyntaxHighlighter
Named theme constructor for SyntaxHighlighter.
impl SyntaxHighlighter
Named theme constructor for SyntaxHighlighter.
Sourcepub fn with_named_theme(theme_name: &str) -> SyntaxHighlighter
Available on crate feature markdown-preview only.
pub fn with_named_theme(theme_name: &str) -> SyntaxHighlighter
markdown-preview only.Create a new syntax highlighter with a specific theme name.
§Arguments
theme_name- Name of the theme (e.g., “base16-ocean.dark”, “github-dark”, “github-light”)
impl SyntaxHighlighter
Find syntax method for SyntaxHighlighter.
Source§impl SyntaxHighlighter
impl SyntaxHighlighter
Source§impl SyntaxHighlighter
Highlight with line numbers method for SyntaxHighlighter.
impl SyntaxHighlighter
Highlight with line numbers method for SyntaxHighlighter.
Source§impl SyntaxHighlighter
Set dark theme method for SyntaxHighlighter.
impl SyntaxHighlighter
Set dark theme method for SyntaxHighlighter.
Sourcepub fn set_dark_theme(&mut self)
Available on crate feature markdown-preview only.
pub fn set_dark_theme(&mut self)
markdown-preview only.Set the theme to dark mode.
Source§impl SyntaxHighlighter
Set light theme method for SyntaxHighlighter.
impl SyntaxHighlighter
Set light theme method for SyntaxHighlighter.
Sourcepub fn set_light_theme(&mut self)
Available on crate feature markdown-preview only.
pub fn set_light_theme(&mut self)
markdown-preview only.Set the theme to light mode (GitHub Light).
Source§impl SyntaxHighlighter
Theme variant getter method for SyntaxHighlighter.
impl SyntaxHighlighter
Theme variant getter method for SyntaxHighlighter.
Sourcepub fn theme_variant(&self) -> SyntaxThemeVariant
Available on crate feature markdown-preview only.
pub fn theme_variant(&self) -> SyntaxThemeVariant
markdown-preview only.Get the current theme variant.
Source§impl SyntaxHighlighter
Toggle theme method for SyntaxHighlighter.
impl SyntaxHighlighter
Toggle theme method for SyntaxHighlighter.
Sourcepub fn toggle_theme(&mut self)
Available on crate feature markdown-preview only.
pub fn toggle_theme(&mut self)
markdown-preview only.Switch between light and dark themes.
Trait Implementations§
Source§impl Default for SyntaxHighlighter
Available on crate feature markdown-preview only.Default trait implementation for SyntaxHighlighter.
impl Default for SyntaxHighlighter
markdown-preview only.Default trait implementation for SyntaxHighlighter.
Source§fn default() -> SyntaxHighlighter
fn default() -> SyntaxHighlighter
Auto Trait Implementations§
impl !Freeze for SyntaxHighlighter
impl RefUnwindSafe for SyntaxHighlighter
impl Send for SyntaxHighlighter
impl Sync for SyntaxHighlighter
impl Unpin for SyntaxHighlighter
impl UnsafeUnpin for SyntaxHighlighter
impl UnwindSafe for SyntaxHighlighter
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more