File: README.md

package info (click to toggle)
rust-pikchr 0.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 456 kB
  • sloc: ansic: 6,736; makefile: 42; sh: 1
file content (39 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Pikchr - Diagram renderer
=========================

Taken from the [pikchr](https://pikchr.org/home/doc/trunk/homepage.md) homepage:

> Pikchr (pronounced like "picture") is a [PIC][1]-like markup
> language for diagrams in technical documentation.  Pikchr is
> designed to be embedded in [fenced code blocks][2] of
> Markdown (or in similar mechanisms in other markup languages)
> to provide a convenient means of showing diagrams.
> 
> [1]: https://en.wikipedia.org/wiki/Pic_language
> [2]: https://spec.commonmark.org/0.29/#fenced-code-blocks

This crate wrappers the `pikchr.c` version downloaded from that website
on the 28th February 2025.

You can use it as follows:

```rust
use pikchr::{Pikchr, PikchrFlags};

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

println!("{}", piccy);
```

There is a little helper program that reads a Pikchr file named on the
command line and renders it as SVG to the standard output:

~~~sh
cargo run -p pikchr-cli -q foo.pikchr > foo.svg
~~~

You can install it with `cargo install pikchr-cli` (`cargo install
--path=pikchr-cli` from the source tree).