#markdown #md #html #svg #pic

pikchr

PIC-like diagramming language to SVG converter

2 releases

0.1.1 May 8, 2021
0.1.0 Oct 24, 2020

#6 in #md

Download history 178/week @ 2022-06-08 101/week @ 2022-06-15 71/week @ 2022-06-22 205/week @ 2022-06-29 58/week @ 2022-07-06 84/week @ 2022-07-13 92/week @ 2022-07-20 235/week @ 2022-07-27 112/week @ 2022-08-03 114/week @ 2022-08-10 66/week @ 2022-08-17 56/week @ 2022-08-24 111/week @ 2022-08-31 88/week @ 2022-09-07 120/week @ 2022-09-14 92/week @ 2022-09-21

413 downloads per month
Used in 6 crates (2 directly)

MIT/Apache

290KB
7K SLoC

C 6.5K SLoC // 0.1% comments Rust 159 SLoC // 0.0% comments

Pikchr - Diagram renderer

Taken from the pikchr homepage:

Pikchr (pronounced like "picture") is a PIC-like markup language for diagrams in technical documentation. Pikchr is designed to be embedded in fenced code blocks of Markdown (or in similar mechanisms in other markup languages) to provide a convenient means of showing diagrams.

This crate wrappers the pikchr.c version downloaded from that website on the 8th May 2021.

You can use it as follows:

use pikchr::{Pikchr, PikchrFlags};

let piccy = Pikchr::render(
    diagram_str,
    None,
    PikchrFlags::default()).unwrap();

println!("{}", piccy);

lib.rs:

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" "(docs.rs/markdown)" fit
arrow right 200% "HTML+SVG" "Output"
arrow <-> down 70% from last box.s
box same "Pikchr" "Formatter" "(docs.rs/pikchr)" fit
"#;

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

println!("{}", pic);

MarkdownSourceMarkdownFormatter(docs.rs/markdown)HTML+SVGOutputPikchrFormatter(docs.rs/pikchr)

Dependencies

~175KB