Crate pikchr

source ·
Expand description

Pikchr image creation binding

This crate provides a binding for the pikchr diagramming language. Using this crate you can convert PIC-like markup into SVG diagrams trivially. If you are embedding into HTML then you can have any errors generated as HTML, otherwise errors are generated as plain text.

The main interface is the Pikchr struct, specifically its Pikchr::render function.

use pikchr::{Pikchr, PikchrFlags};

let INPUT = r#"
arrow right 200% "Markdown" "Source"
box rad 10px "Markdown" "Formatter" "(" fit
arrow right 200% "HTML+SVG" "Output"
arrow <-> down 70% from last box.s
box same "Pikchr" "Formatter" "(" fit

let pic = Pikchr::render(INPUT, None, PikchrFlags::default()).unwrap();

println!("{}", pic);