Struct cobalt::SyntaxHighlight
source · #[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 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.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