# Book Pipeline

The course compiles into a six-volume book series. The book is a companion, not a replacement: interactive figures, graded quizzes, and runnable code stay on the website and in this repository, and every chapter ends with the links that take the reader there.

## Volumes

Defined in `volumes.json`. Each volume maps to a band of phases:

| Vol | Title | Phases |
|-----|-------|--------|
| 1 | Foundations | 00-02 |
| 2 | Deep Learning | 03, 04, 06 |
| 3 | Language | 05, 07 |
| 4 | Large Language Models | 08-11 |
| 5 | Agents | 12-16 |
| 6 | Production | 17-19 |

## Build

```bash
python3 scripts/build_book.py                  # all volumes, EPUB
python3 scripts/build_book.py --volume language
python3 scripts/build_book.py --pdf            # adds PDF (needs xelatex + DejaVu fonts)
```

Requires pandoc. Optional: `@mermaid-js/mermaid-cli` (mmdc) to render mermaid diagrams as images; without it they become web-edition pointers. Output lands in `dist/book/`.

CI (`.github/workflows/build-book.yml`) builds EPUBs on every push that touches `phases/`, and EPUB + PDF on releases, attaching both to the release.

## What the assembler does per lesson

- Lesson `# title` becomes a chapter; phases become unnumbered part pages.
- `figure` blocks (interactive JS widgets) become boxed pointers to the lesson's web edition.
- Mermaid blocks render to SVG when mmdc is available, otherwise become web pointers.
- `## Ship It` sections are replaced with a pointer to the repo artifact.
- `## Exercises` gains a starter-code link into the lesson's `code/` directory.
- Every chapter closes with a Continue Online box: web edition, code, quiz.
- Asset image paths are rewritten so pandoc embeds the lesson SVGs.

The machine-readable index agents use to navigate the course (`site/llms.txt`, generated by `site/build.js` on deploy) links each lesson's raw markdown, and the book's "Learning with an AI" front page tells readers how to point their assistant at it.
