pub struct HighlightPlugin { /* private fields */ }Expand description
Plugin that adds syntax highlighting CSS classes to code blocks.
Runs in after_compile. Finds <pre><code class="language-X">
blocks and injects classes. Also generates highlight.css.
Implementations§
Source§impl HighlightPlugin
impl HighlightPlugin
Sourcepub fn new(theme: impl Into<String>) -> Self
pub fn new(theme: impl Into<String>) -> Self
Creates a new HighlightPlugin with the given theme.
§Examples
use ssg::highlight::HighlightPlugin;
use ssg::plugin::Plugin;
let p = HighlightPlugin::new("monokai");
assert_eq!(p.name(), "highlight");Sourcepub fn with_theme(theme: impl Into<String>) -> Self
pub fn with_theme(theme: impl Into<String>) -> Self
Creates a highlight plugin with the given theme name.
§Examples
use ssg::highlight::HighlightPlugin;
use ssg::plugin::Plugin;
let p = HighlightPlugin::with_theme("solarized");
assert_eq!(p.name(), "highlight");Trait Implementations§
Source§impl Clone for HighlightPlugin
impl Clone for HighlightPlugin
Source§fn clone(&self) -> HighlightPlugin
fn clone(&self) -> HighlightPlugin
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HighlightPlugin
impl Debug for HighlightPlugin
Source§impl Default for HighlightPlugin
impl Default for HighlightPlugin
Source§impl Plugin for HighlightPlugin
impl Plugin for HighlightPlugin
Source§fn has_transform(&self) -> bool
fn has_transform(&self) -> bool
Returns
true if this plugin implements transform_html.
Override to true to opt in to the fused transform pass.Source§fn transform_html(
&self,
html: &str,
_path: &Path,
_ctx: &PluginContext,
) -> Result<String, SsgError>
fn transform_html( &self, html: &str, _path: &Path, _ctx: &PluginContext, ) -> Result<String, SsgError>
Per-file HTML transform hook — called once per HTML file during
the fused transform pass. Read more
Source§fn after_compile(&self, ctx: &PluginContext) -> Result<(), SsgError>
fn after_compile(&self, ctx: &PluginContext) -> Result<(), SsgError>
Called after site compilation completes. Read more
Source§fn before_compile(&self, _ctx: &PluginContext) -> Result<(), SsgError>
fn before_compile(&self, _ctx: &PluginContext) -> Result<(), SsgError>
Called before site compilation begins. Read more
Source§fn needs_all_files(&self) -> bool
fn needs_all_files(&self) -> bool
Returns
true if this plugin must always observe the full
cache.html_files() list — even during --incremental
rebuilds that only invalidated a handful of pages. Read moreAuto Trait Implementations§
impl Freeze for HighlightPlugin
impl RefUnwindSafe for HighlightPlugin
impl Send for HighlightPlugin
impl Sync for HighlightPlugin
impl Unpin for HighlightPlugin
impl UnsafeUnpin for HighlightPlugin
impl UnwindSafe for HighlightPlugin
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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