A Rust implementation of [pikchr](https://pikchr.org/), a PIC-like diagram
markup language for creating technical diagrams that generates SVG.

## Usage

```rust
let svg = pikru::pikchr(r#"box "Hello" arrow box "World""#).unwrap();
assert!(svg.contains("<svg"));
```

## Light/Dark Mode

Enable CSS variables for automatic light/dark theming:

```rust
use pikru::{pikchr_with_options, RenderOptions};

let options = RenderOptions { css_variables: true };
let svg = pikchr_with_options(r#"box "Hello""#, &options).unwrap();
assert!(svg.contains("light-dark("));
```

The generated SVG includes a `<style>` block with CSS variables using
`light-dark()`, so colors automatically adapt to the user's color scheme.

## Development

### Testing

The test suite validates output against the original C implementation:

```bash
cargo test                     # Run all tests
cargo xtask compare-html       # Generate visual comparison HTML
cargo xtask generate-pngs      # Convert SVGs to PNGs for debugging
```

See `comparison.html` for a side-by-side visual comparison of C vs Rust output.

### Pre-commit Hooks

```bash
./hooks/install.sh
```

## Attribution

pikru is a direct Rust port of:

- **[pikchr](https://pikchr.org/)** by D. Richard Hipp - The original C
  implementation, released under the
  [0-clause BSD license](https://pikchr.org/home/doc/trunk/doc/license.md).
  The C source is vendored in `vendor/pikchr-c/` for reference.

Also referenced during development:

- **[gopikchr](https://github.com/gopikchr/gopikchr)** - A Go port of pikchr
  by [@zellyn](https://github.com/zellyn).
