iftypeset/README.md
2026-01-03 20:29:35 +00:00

2.3 KiB
Raw Export PDF Blame History

iftypeset (pubstyle) — publication-quality typesetting pipeline

This project is a thin, deterministic runtime for turning Markdown into highquality HTML/PDF using:

  • A machinereadable rule registry (Chicago / Bringhurst pointers; paraphrased rules only)
  • Typeset profiles (spec/profiles/*.yaml) that map typographic intent → render tokens
  • Postrender QA gates (spec/quality_gates.yaml) that fail builds when layout degrades

It is designed to be embedded into constrained workers (e.g. Forgejo PDF export with --network=none) and also run as a standalone CLI.

Status: working spec + seeded rule registry. See STATUS.md.

Constraints (non-negotiable)

  • No bulk OCR/transcription of Chicago/Bringhurst into this repo (copyright).
  • Rule records are paraphrases only, backed by pointers (e.g. CMOS18 §X.Y pNNN (scan pMMM)).
  • Chicago OCR (when needed) must be ephemeral (extract just enough to locate pointers; do not store page text).

Quickstart (current)

From ai-workspace/iftypeset/:

  • (Optional) Install deps into a venv: python3 -m venv .venv && . .venv/bin/activate && python -m pip install -r requirements.txt
  • Validate spec + rebuild indexes: PYTHONPATH=src python3 -m iftypeset.cli validate-spec --spec spec --build-indexes
  • Lint Markdown: PYTHONPATH=src python3 -m iftypeset.cli lint --input fixtures/sample.md --out out --profile web_pdf
  • Render HTML + CSS: PYTHONPATH=src python3 -m iftypeset.cli render-html --input fixtures/sample.md --out out --profile web_pdf
  • Render PDF (if an engine is installed): PYTHONPATH=src python3 -m iftypeset.cli render-pdf --input fixtures/sample.md --out out --profile web_pdf
  • Run QA gates (HTML fallback if no PDF): PYTHONPATH=src python3 -m iftypeset.cli qa --out out --profile web_pdf
  • Coverage report: PYTHONPATH=src python3 -m iftypeset.cli report --spec spec --out out
  • Run self-check tests: python3 -m unittest discover -s tests -p 'test_*.py'

PDF renderers

render-pdf will use the first available engine in this order:

  • playwright (Python module)
  • chromium / chromium-browser / google-chrome
  • wkhtmltopdf
  • weasyprint (Python module)

If none are installed, the command exits with a clear message but still leaves HTML artifacts for QA.