pub struct Mermaid { /* private fields */ }Expand description
Pre-render mermaid diagrams to inline SVG via the external mmdc CLI
(@mermaid-js/mermaid-cli).
Two input shapes are handled:
```mermaidfenced code blocks - replaced with<MermaidDiagram chart="..." {mode}Svg="<svg...>" ... />.- Author-written
<MermaidDiagram chart={…} />JSX nodes - the existing JSX node is preserved and{mode}Svgattributes are appended.
Theme behavior is driven by MermaidOptions::theme:
Single("dark") renders once and emits a single chartSvg attr;
Multi({ light: "default", dark: "dark" }) (the default) renders
per-mode and emits lightSvg + darkSvg.
Per-block failures emit Code::MermaidRenderFailed. The CLI
availability probe runs once per process; missing CLI -> the whole
transformer becomes a no-op with Code::MmdcUnavailable.
Implementations§
Source§impl Mermaid
impl Mermaid
Sourcepub fn from_options(opts: MermaidOptions) -> Self
pub fn from_options(opts: MermaidOptions) -> Self
Build a Mermaid transformer with the supplied options. Use
Mermaid::default() for the bundled defaults.
Sourcepub fn with_output(p: impl Into<PathBuf>) -> Self
pub fn with_output(p: impl Into<PathBuf>) -> Self
Convenience constructor preserved for backward compat: enables
the disk cache at dir.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Mermaid
impl RefUnwindSafe for Mermaid
impl Send for Mermaid
impl Sync for Mermaid
impl Unpin for Mermaid
impl UnsafeUnpin for Mermaid
impl UnwindSafe for Mermaid
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