codesnap 0.13.2

Pure Rust library for generating beautiful code snapshots
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use codesnap::config::{CodeSnap, Content};

pub fn main() -> anyhow::Result<()> {
    let data = std::fs::read("core/examples/screenshot.png").unwrap();
    let code_content = Content::Image(data);

    let snapshot = CodeSnap::from_default_theme()?
        .content(code_content)
        .build()?
        .create_snapshot()?;

    // Copy the snapshot data to the clipboard
    snapshot.raw_data()?.copy()
}