# jcv — JSON Canvas Viewer

Terminal viewer for [JSON Canvas 1.0](https://jsoncanvas.org/) files, with live reload.

`jcv` opens a `.canvas` file straight in your TTY: pan, zoom, and watch it
update in real time as you edit the file in Obsidian (or any other editor). No
GUI, no browser, no SSH tunnels.

## Install

```bash
# from crates.io
cargo install jcv

# or grab a prebuilt binary from the latest GitHub release:
#   https://github.com/hgflima/jcv/releases
```

Pre-built binaries are produced for macOS (x86_64 + arm64) and Linux (x86_64).
Windows is not supported in v0.

## Usage

```bash
jcv path/to/file.canvas      # open and watch
jcv --help                   # flags and keymap
jcv --version
```

While the viewer is open:

| Key                       | Action                          |
| ------------------------- | ------------------------------- |
| `h` `j` `k` `l` / arrows  | Pan the viewport                |
| `+` / `-`                 | Zoom in / out                   |
| `?`                       | Toggle the help overlay         |
| `q` / `Esc`               | Quit (or close the help overlay)|
| `Ctrl-C`                  | Quit                            |

The viewer is read-only: `jcv` never writes to your `.canvas` file. When the
file changes on disk it is re-parsed and re-rendered within ~500 ms; if the
new contents are invalid you see an error banner and keep the previous view
instead of crashing.

## Supported nodes

All four JSON Canvas 1.0 node kinds render:

- **text** — markdown body shown as plain text inside a bordered box
- **file** — path with a file icon (or `[F]` when `NO_COLOR` is set)
- **link** — URL with an OSC 8 hyperlink where the terminal supports it
- **group** — dashed border drawn behind its children

Edges route Manhattan-style with one elbow, fall back to ASCII (`-|+`) when
Unicode box-drawing is unavailable, and truncate labels with `…` when there
isn't room.

## Environment

- `NO_COLOR` — disables colour output entirely
- `JCV_LOG` — `tracing` env filter (default `info`); logs go to
  `$XDG_STATE_HOME/jcv/jcv.log` (`~/.local/state/jcv/jcv.log` on Linux,
  `~/Library/Application Support/jcv/jcv.log` on macOS)

## Building from source

```bash
git clone https://github.com/hgflima/jcv
cd jcv
cargo build --release
./target/release/jcv tests/fixtures/all-node-types.canvas
```

Requires a stable Rust toolchain (MSRV 1.75).

## Status

v0 is a viewer. Editing, PNG export, and a desktop GUI are deferred to later
releases — see [`docs/SPEC.md`](docs/SPEC.md) for the scope and
[`docs/PLAN.md`](docs/PLAN.md) for the roadmap.

## License

MIT — see [`LICENSE`](LICENSE).
