affine_preview 0.1.0

Native Mermaid and Typst SVG rendering for AFFiNE.
Documentation
#[cfg(feature = "mermaid")]
mod mermaid;
#[cfg(feature = "typst")]
mod typst;

#[cfg(feature = "mermaid")]
pub use mermaid::{MermaidRenderOptions, render_mermaid_svg};
#[cfg(feature = "typst")]
pub use typst::{TypstRenderOptions, render_typst_svg};

#[derive(Debug, thiserror::Error)]
pub enum PreviewError {
  #[error("{0}")]
  Mermaid(String),
  #[error("{0}")]
  Typst(String),
  #[error("failed to prepare preview cache: {0}")]
  Cache(#[from] std::io::Error),
}

pub type Result<T> = std::result::Result<T, PreviewError>;