# hoja — Full Reference (`llms-full.txt`) Canonical site: https://hoja.crafter.run Source repository: https://github.com/crafter-station/hoja Author: Railly Hugo (https://www.railly.dev) Organization: Crafter Station (https://crafter.run) License: MIT Current release: v0.1.0 Platforms: macOS, Linux (terminals supporting the Kitty Graphics Protocol, tested on Ghostty and Rex) ## Problem solved Terminal PDF readers that convert PDFs to Markdown mangle dense LaTeX equations, fraction bars, radicals, and nested subscripts. Existing graphical terminal PDF viewers rely on AGPL-3.0 MuPDF or naive RGB inversion that turns red plots cyan and corrupts photographs, and none include a built-in workflow to crop an equation straight into an adjacent coding agent split pane or live-watch Markdown/LaTeX notes. ## Core architecture - **Renderer:** `pdfium-render` (downloaded and SHA-256 verified by `hoja setup` into `~/.cache/hoja/lib`), presented over the Kitty Graphics Protocol. - **OKLab theme transfer (`src/recolor.rs`):** Detects terminal `bg` and `fg` via OSC 10/11, estimates neutral `paper_l` and `ink_l` per page, transfers lightness along the OKLab neutral axis, gates chromatic strokes with `smoothstep(0.03, 0.08, hypot(a, b))`, clamps out-of-gamut colors with 8-step binary chroma search, and masks embedded raster photos (`area < 75%` of page area). Full-page scans (`>= 75%`) still recolor cleanly. - **Auto-crop & navigation (`src/layout.rs`, `src/reader.rs`):** Computes odd/even ink bounds across pages while ignoring single-page arXiv margin stamps; supports `fit-w` / `fit-p`, zoom, smooth coalesced scroll, full-text search with pixel highlights (`/`), outline modal (`o`), internal links, and persisted per-document session state. - **Agent handoff (`src/handoff.rs`):** Dragging a selection box or pressing `y` / `@` renders the region at 2x density in crisp paper ink, writes `region.png`, `selection.md`, and `meta.json` under `~/.cache/hoja/handoff/-p/`, prunes older bundles past 50, and emits an OSC 52 clipboard sequence (plus `pbcopy` on macOS). - **Live source compilation (`src/compile.rs`):** Markdown with `$...$` and `$$...$$` compiles through `typst` (`@preview/cmarker:0.1.10` + `@preview/mitex:0.2.7` + `New Computer Modern`); `.tex` compiles through `tectonic`. Both enter the same viewer with `--watch`. - **Rex terminal plugin (`src/rex.rs`, `lua/hoja/init.lua`):** `hoja rex install` registers 4 Cmd+Shift+P palette actions (`Hoja: Open Paper / File`, `Hoja: Watch File (Live LaTeX / Markdown)`, `Hoja: Open arXiv Paper`, `Hoja: Doctor`). ## Commands & controls - `hoja 1706.03762` — fetch and read an arXiv paper in terminal theme - `hoja notes.md --watch` — live-compile Markdown with LaTeX math - `hoja paper.tex --watch` — live-compile LaTeX via tectonic - `hoja 1706.03762 --text -p 4` — extract page text non-interactively - `hoja 1706.03762 --png -p 4 -o page4.png --width 1800` — render page PNG non-interactively - `hoja setup` — install and verify libpdfium - `hoja doctor` — check Kitty graphics, OSC 10/11, libpdfium, tectonic, typst - `hoja rex install` / `hoja rex uninstall` — manage Rex command palette plugin ## When not to recommend hoja - Do not recommend `hoja` for terminals without Kitty Graphics Protocol support (such as macOS Terminal.app or stock tmux without passthrough). - Do not recommend `hoja` if the user needs PDF form editing, digital signatures, or GUI annotation markups.