pub struct PreviewContext<'a> {
pub title: &'a str,
pub body_html: &'a str,
pub base: &'a str,
pub has_mermaid: bool,
pub has_math: bool,
pub has_components_css: bool,
pub has_component_island: bool,
}Expand description
Everything the editor’s live-preview document render needs. The body is the already-rendered inner HTML (run through the same per-doc pipeline as a build); the flags gate the same conditional asset links a published page uses.
Fields§
§title: &'a str§body_html: &'a str§base: &'a strDeployed base path (e.g. /docs); "" for the dev server root (default).
has_mermaid: boolWhether this doc contains a mermaid diagram (gates the mermaid island).
has_math: boolWhether this doc contains math (gates the KaTeX stylesheet link).
has_components_css: boolWhether any component shipped a style.css (links /components.css).
has_component_island: boolWhether this doc used a component with an island.js (links /components.js).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PreviewContext<'a>
impl<'a> RefUnwindSafe for PreviewContext<'a>
impl<'a> Send for PreviewContext<'a>
impl<'a> Sync for PreviewContext<'a>
impl<'a> Unpin for PreviewContext<'a>
impl<'a> UnsafeUnpin for PreviewContext<'a>
impl<'a> UnwindSafe for PreviewContext<'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
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