#[non_exhaustive]pub struct SyntaxHighlight { /* private fields */ }
Expand description
Highlight code block
Implementations§
Source§impl Syntax
impl Syntax
pub fn new() -> Syntax
Available on crate feature
syntax-highlight
only.pub fn load_custom_syntaxes(&mut self, syntaxes_path: &Path)
Available on crate feature
syntax-highlight
only.pub fn css_theme_name() -> &'static str
Available on crate feature
syntax-highlight
only.pub fn has_theme(&self, name: &str) -> bool
Available on crate feature
syntax-highlight
only.pub fn themes(&self) -> impl Iterator<Item = String>
Available on crate feature
syntax-highlight
only.Sourcepub fn css_for_theme(&self, name: &str) -> String
Available on crate feature syntax-highlight
only.
pub fn css_for_theme(&self, name: &str) -> String
syntax-highlight
only.Get the content of a css file to apply the specified color theme when using the ‘css’ theme
pub fn syntaxes(&self) -> impl Iterator<Item = String>
Available on crate feature
syntax-highlight
only.pub fn default_theme(&self) -> Option<&str>
Available on crate feature
syntax-highlight
only.pub fn set_default_theme(&mut self, theme: impl Into<String>)
Available on crate feature
syntax-highlight
only.pub fn format( &self, code: &str, lang: Option<&str>, theme: Option<&str>, ) -> String
Available on crate feature
syntax-highlight
only.Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Syntax
impl RefUnwindSafe for Syntax
impl Send for Syntax
impl Sync for Syntax
impl Unpin for Syntax
impl UnwindSafe for Syntax
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
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>
Converts
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>
Converts
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