pub struct SyntectAdapter { /* private fields */ }Expand description
A syntect-backed adapter for comrak’s rendering plugin system.
Performs syntax highlighting during HTML rendering using
class-based output. The adapter does not emit <pre> / <code>
itself — comrak’s renderer handles those tags via
[SyntaxHighlighterAdapter::write_pre_tag] and
[SyntaxHighlighterAdapter::write_code_tag].
Implementations§
Source§impl SyntectAdapter
impl SyntectAdapter
Sourcepub fn new(theme: Option<&str>) -> Self
pub fn new(theme: Option<&str>) -> Self
Creates a new adapter, optionally with a named theme.
The theme name is retained so callers can recover it via
SyntectAdapter::theme_name and pass it to theme_css
when generating a stylesheet for the rendered output. Falls
back to DEFAULT_THEME when the requested theme is not in
syntect’s built-in set.
Sourcepub fn theme_name(&self) -> &str
pub fn theme_name(&self) -> &str
Returns the resolved theme name (after fallback).
Sourcepub fn available_themes() -> Vec<&'static str>
pub fn available_themes() -> Vec<&'static str>
Returns the list of available theme names.
Trait Implementations§
Source§impl SyntaxHighlighterAdapter for SyntectAdapter
impl SyntaxHighlighterAdapter for SyntectAdapter
Source§fn write_highlighted(
&self,
output: &mut dyn Write,
lang: Option<&str>,
code: &str,
) -> Result
fn write_highlighted( &self, output: &mut dyn Write, lang: Option<&str>, code: &str, ) -> Result
Generates a syntax highlighted HTML output. Read more
Auto Trait Implementations§
impl Freeze for SyntectAdapter
impl RefUnwindSafe for SyntectAdapter
impl Send for SyntectAdapter
impl Sync for SyntectAdapter
impl Unpin for SyntectAdapter
impl UnsafeUnpin for SyntectAdapter
impl UnwindSafe for SyntectAdapter
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