# PDFs, arXiv, web articles, EPUB books, and source.

> Every document type enters the same GPU-scrolled reader with OKLab theme ink, continuous scroll, link hints, cross-stack search, and layered annotations.

- Canonical URL: https://hoja.crafter.run/docs/formats
- Version: 0.2.1

## One command per source type.

```sh
hoja document.pdf                       # local PDF, mixed page sizes preserved
hoja 1706.03762                         # arXiv ID, cached locally, resumes page
hoja https://example.com/deck.pdf       # remote PDF validated by %PDF- header
hoja https://example.com/post           # web article -> Markdown -> sandboxed Typst
hoja book.epub                          # EPUB unpacked in memory -> Typst
hoja secret.pdf --password 'hunter2'    # encrypted PDF (or HOJA_PDF_PASSWORD)
hoja notes.typ --watch                  # Typst source, live reload
hoja notes.md --watch                   # Markdown with $...$ and $$...$$ math
hoja paper.tex --watch                  # LaTeX via tectonic
```

| Source | Engine | Safeguards & behavior |
| --- | --- | --- |
| Local PDF / arXiv | pdfium-render | Bounded 8-page LRU cache + 3x double-buffered GPU strips; 500-page books stay flat |
| Remote PDF URL | pdfium-render | Sniffed by %PDF- magic bytes, 512 MiB cap, query tokens stripped from titles and logs |
| Web article URL | defuddle / Rust HTML + Typst | Uses defuddle when on PATH, else built-in pure-Rust extractor; set HOJA_DEFUDDLE=0 to force built-in |
| EPUB book | In-memory ZIP + Typst | Rejects zip bombs, zip-slip paths, XML entity expansion, and DRM-protected files before rendering |
| Encrypted PDF | pdfium-render | Password read from --password or HOJA_PDF_PASSWORD in memory only; never saved to disk |
| .md / .tex / .typ | Typst (cmarker+mitex) / tectonic | Compiles in place on save with --watch without losing your scroll position |

## Safe web and EPUB rendering.

Web articles and EPUB books compile inside a scratch directory with typst --root, with raw Typst injection disabled (raw-typst: false) and math routed through a MiTeX guard. Compiled PDFs cache under ~/Library/Caches/hoja/url and ~/Library/Caches/hoja/epub (or ~/.cache/hoja/ on Linux) alongside a title sidecar so the stack switcher shows readable titles.

**Optional tools:** Install typst for web articles, EPUB books, .typ files, and Markdown math; install tectonic for .tex files. Missing compilers only disable those source front doors, never PDF reading. Check status with hoja doctor.

## When not to use hoja.

hoja is read-only toward source documents. It intentionally rejects DRM-protected EPUBs and does not fill interactive PDF forms, apply digital signatures, or mutate embedded PDF annotations in place.
