Skip to content

Keep a repo's docs on paper

A repo’s paper.yml says which of its markdown files go to your device. Reading copies stay current as the files change, and proofs go out one round at a time. Something has to do the sending whenever the repo changes, and you pick who:

  • Your laptop (placed_by: local): freehand watch sees a new commit and sends. No GitHub setup, but it only runs while the computer is on.
  • GitHub Actions (placed_by: workflow, the default): a workflow renders on every push and the freehand script places the PDFs in Drive within a minute. It works with every computer off.

A repo is sent by one of them, never both.

Put this at the repo’s root. Every part is optional:

copies: # kept current on the device; marks become notes
- docs/**/*.md
folder: study/my-repo # where this repo's copies go, under the device's documents folder
proofs: # one round each, and the line is removed once it's sent
- docs/plan.md
edits: pull-request # how a proof's edits come back: pull-request, or main
placed_by: local # who sends: local (your laptop) or workflow (CI, the default)

The whole format is in the paper.yml reference.

From the repo’s root:

Terminal window
freehand paper --plan

It lists the copies whose words, pictures or renderer changed since they were last sent, and the proofs waiting in the queue.

Name the repo in your watch config, ~/.freehand/config.yml:

repos: [~/notes]

(freehand init --repo ~/notes writes that for you.) Then send now and keep sending:

Terminal window
freehand paper --place "<your drive>" # send what's due, right now
freehand watch # then send whenever a new commit lands

To keep it running without a terminal, see run the watcher in the background. The watcher writes freehand/paper.json (what was sent, so a copy goes again only when it changed) but leaves committing it to you.

  1. Add the workflow. In a checkout of the repo:

    Terminal window
    freehand add-repo .

    It writes a paper.yml if there isn’t one, and the workflow .github/workflows/send-to-paper.yml, which calls Freehand’s shared workflow. It commits nothing: commit it the way the repo likes. An existing paper.yml is never changed.

  2. Give the script access. In the freehand script’s Project Settings, Script properties, add GITHUB_REPO (owner/name) and GITHUB_TOKEN, a fine-grained token for that one repo with Actions read and write. The script uses it to list and download what the workflow rendered, and to delete the artifact once it’s placed.

  3. Push. On each push to main that touches paper.yml or a markdown file, the workflow renders what’s due, and the script puts the PDFs on your device within a minute. It commits freehand/paper.json and takes sent proofs off the queue.

Optional repo settings: the variable FREEHAND_TIME_ZONE (your time zone, for the date on the pages) and, while Freehand or your fork is private, the secret FREEHAND_TOKEN.

Change placed_by in its paper.yml: local to send from your laptop, workflow to hand it back to CI.

A repo whose pages should look their own way

Section titled “A repo whose pages should look their own way”

A repo can name its own renderer for copies, proofs or both. Freehand still names, places and records the PDF. See renderers: in the paper.yml reference.