pub struct Highlighter<'a> { /* private fields */ }Expand description
Reusable highlighter for pulldown_cmark fenced code blocks.
Implementations§
Source§impl<'a> Highlighter<'a>
impl<'a> Highlighter<'a>
Sourcepub fn new(registry: &'a Registry, html: HtmlOptions<'_>) -> Self
pub fn new(registry: &'a Registry, html: HtmlOptions<'_>) -> Self
Constructs a Highlighter backed by registry and html options.
wrapper is always set to HtmlWrapper::Pre.
Sourcepub const fn with_auto_detect(self, enabled: bool) -> Self
pub const fn with_auto_detect(self, enabled: bool) -> Self
Enables or disables limn::detect_in for fenced code blocks without a
language info string.
Sourcepub const fn events<'src, I>(&self, events: I) -> HighlightEvents<'_, I> ⓘ
pub const fn events<'src, I>(&self, events: I) -> HighlightEvents<'_, I> ⓘ
Wraps any pulldown_cmark Event iterator, replacing fenced code
blocks with highlighted Event::Html while passing all other events
through unchanged.
Sourcepub fn render_html(&self, markdown: &str) -> String
pub fn render_html(&self, markdown: &str) -> String
Parses markdown with default pulldown_cmark::Parser options,
highlights fenced code blocks, and returns rendered HTML.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Highlighter<'a>
impl<'a> !UnwindSafe for Highlighter<'a>
impl<'a> Forget for Highlighter<'a>
impl<'a> Freeze for Highlighter<'a>
impl<'a> Move for Highlighter<'a>
impl<'a> Send for Highlighter<'a>
impl<'a> Sync for Highlighter<'a>
impl<'a> Unpin for Highlighter<'a>
impl<'a> UnsafeUnpin for Highlighter<'a>
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