Exercises for Part II
Quarto, reproducible publishing, coding agents, Markdown, Python, EPUB, data analysis, k-means clustering
The first five exercises collect Part II’s hands-on work in order. Each names the chapter that explains it, how you know you are done, and the line that catches you up if you are not; a checkpoint is the state at the end of its block, so after catching up, skip to the next exercise. Appendix E — Checkpoints at a Glance, and Answers has the whole table. If you did the chapters’ steps, use these five as a checklist: confirm each “done when” and move on. If you read without doing, do them here, in order. Each “done when” asks for the three checks of Three checks for every change where they fit: scope (git status and git diff list only the files you meant to change), correctness (one number or fact traced by hand to its row in data/) and rebuild (a render from what you committed gives the same result). The exercises after these five leave the prompts out. In the transfer tasks you write the prompt and the check yourself, and the review questions test whether the reasons stuck; short answers are at the end.
Start the agent in ~/london-guide/, next to ~/quarto-workshop/. Catching up reads outside that folder, so approve the agent’s request to read ../quarto-workshop.
Exercise II.1: London in Markdown
From 6 Markdown, Rendering and Project Rules. Start the folder’s history by hand (git init -b main, a .gitignore and a first commit); write london.md with a heading, lists, a link, the Big Ben photo with alt text and credit, a quotation, a table from data/sights.csv and a code fence; render it and keep a live preview; write the project’s AGENTS.md; give the folder its own environment with uv. Read each step’s git diff and commit it.
You’re done when london.html shows both lists, the photo with its credit, the five-row table and the checklist, uv run quarto check jupyter reports the Python in this folder’s .venv, one price band in the table matches its row in data/sights.csv, and git log --oneline lists one commit per step with git status clean.
Stuck for two minutes? Paste this into your agent. It backs up your work and brings the project to this point; then carry on from here.
Catch me up: follow ../quarto-workshop/checkpoints/01-london-markdown/README.mdExercise II.2: A document that computes
From 7 Documents That Compute. Rename the guide to london.qmd with front matter, add a cell that reads data/attractions.csv and a sentence with inline code, add a captioned, labelled bar chart, then render to HTML, Word and a Typst PDF (and, optionally, PowerPoint, EPUB and Reveal.js).
You’re done when london.html shows the title block, the computed sentence and a numbered chart, and london.docx and london.pdf show the same sentence and chart. The top attraction’s visits in the sentence match its row in data/attractions.csv, and after your commit, with git status clean, uv run quarto render london.qmd gives the same sentence again.
Stuck for two minutes? Paste this into your agent. It backs up your work and brings the project to this point; then carry on from here.
Catch me up: follow ../quarto-workshop/checkpoints/02-london-qmd/README.mdExercise II.3: Three audiences at once
From 8 One Guide, Five Audiences. With one prompt and three sub-agents, write the dashboard, the Word brief with its covering email, and the A5 flyer; the lead renders them one at a time.
You’re done when london-dashboard.html has an Attractions page with three value boxes, a bar chart and a line chart, and a Churches page listing ten churches with Visit London links; london-email.docx opens with headings and working links; london-email-message.md holds the email in one text block; london-flyer.pdf is one A5 page. Before you commit, git status lists those four source files and nothing in data/, images/ or london.qmd.
Stuck for two minutes? Paste this into your agent. It backs up your work and brings the project to this point; then carry on from here.
Catch me up: follow ../quarto-workshop/checkpoints/04-london-audiences/README.mdThere is no checkpoint 03: the workshop’s block numbering skips it.
Exercise II.4: A published website
From 9 Publishing and Proving the Rebuild. Make the folder a website with a navigation bar and a Downloads menu, put it on GitHub, and publish it with an interactive uv run quarto publish gh-pages.
You’re done when https://<your-github-username>.github.io/london-guide/london-dashboard.html opens on your phone, and git status was clean when you published, so the live site was built from what is committed and pushed.
Stuck for two minutes? Paste this into your agent. It backs up your work and brings the project to this point; then carry on from here.
Catch me up: follow ../quarto-workshop/examples/london/README.mdIf you have already published, the catch-up copies the finished project’s README and .gitignore over yours; restore your own with git checkout -- README.md .gitignore.
Exercise II.5: Change an input, explain the rebuild
From Change one input, explain the rebuild, with no prompt supplied. Set the Tower of London’s visits_2025 to 8000000, predict which outputs change, rebuild, explain what changed and what did not, and restore the real value with git restore data/attractions.csv.
You’re done when you can name the outputs that changed, the ones that did not, and the line of code that links each changed output to the input, and after git restore and the second rebuild git status is clean. Model answers are in Appendix E — Checkpoints at a Glance, and Answers.
Write your own prompts
These build on Part II and have no checkpoints. For each, write the prompt yourself, as concrete as the book’s (the files, the columns, the output) and ending with a check you can verify without trusting the agent’s report. If you skipped them, the optional pieces come first: the square advert (A square advert (optional)), the white paper (A white paper (optional)) and the three.js page (The sights in three dimensions (optional)).
- A handout of free attractions. The office wants a one-page A5 handout of the attractions in
data/attractions.csvthat are free to enter, each with its 2025 visits. Decide whichadmissionvalues count as free and say so in the prompt. You are done when the handout lists as many attractions as the dashboard’s “Top 10 with free entry” value box counts, and no number on it was typed. - Then and now. Add a section to
london.qmdcomparing each of the five sights’ 2025 visits with 2019’s, fromdata/visits.csv. Your prompt should say why 2019 is the year to compare with, and ask for the one sight whose counts are not like-for-like to be flagged. You are done when every percentage comes from a cell and the flagged sight is the onedata/README.mdnames. - Turn a copy into a computation. The flyer and the sights tables in the guide and the partner brief all copy their facts from
data/sights.csv(Table 9.3). Make the flyer’s table read the file instead. Your check: change one station name insights.csvyourself, rebuild, and see it on the flyer. Restore the file afterwards. - A map in two dimensions. The 3-D map’s data are in
data/places.csvand the borough boundaries indata/london-boroughs.geojson. Add a third dashboard page that draws the sights and churches on a 2-D Plotly map from those files, with each point’s source in its hover text. Decide how you will check that every point is where it should be. - Update the live site. Change the guide’s welcome sentence, then write one prompt that commits with a message that says why and publishes the update with
uv run quarto publish gh-pages --no-prompt. You are done when the new sentence is on your phone.
Review questions
- The project’s rules say “ALVA member attractions”, never “London’s most visited attractions”. What would be wrong with the second phrase?
- After a prompt to add a “Getting around” list,
git statuslistslondon.mdandAGENTS.mdas modified, andgit diff AGENTS.mdshows the rule “Keepdata/andimages/unchanged” removed. What do you do, and why does this matter more than a wrong word in the guide? - A colleague copies your
london-guide/folder without.venv/. What gives them the same packages as you, and what do they type first? - While
quarto previewruns onlondon.qmd, the agent runsquarto render london.qmdand it fails withreadfile 'london.quarto_ipynb'. What happened, and what are two ways to avoid it? - In the guide’s sentence about visits, which parts update when
attractions.csvchanges, and when? Does any part not update? - The guide’s bar chart has a caption and alt text. What should each say, and why are they not the same?
- You need two changes to
london-dashboard.qmd: a new value box and a fix to the line chart’s legend. Should you give them to two sub-agents working in parallel? - Why is the flyer’s page size set with
papersize: a5, but the square advert’s in a raw Typst block? - Netlify can build your site from the repository, or you can render it yourself and upload it. Which does the London project need, and why?
- After the rebuild in Exercise II.5, the dashboard on your computer shows the Tower of London as the most visited attraction, but the flyer has not changed and the dashboard on your phone still shows the old numbers. Explain both.
Answers
- ALVA counts only its member sites, so its table is not a list of every London attraction. “London’s most visited attractions” would claim more than the data show (Rules for the guide).
- Undo that file alone with
git restore AGENTS.md, check that the diff oflondon.mdholds only the list, and commit that. A wrong word spoils one page and shows in the preview; a removed rule shows nowhere on the page, yet changes every later session, because the agent readsAGENTS.mdat the start of each one, and the guard on the evidence would be gone without anyone deciding it (A checklist that keeps its shape). uv.lock, which records the exact version of every package for every system. Their firstuv runcommand, such asuv run quarto render london.md, builds.venv/from it (An environment for the code to come).- A render writes a temporary notebook named after the file, and the preview was rendering the same file at the same moment, so the two collided. Let the preview do the rendering while it runs, or stop it with Ctrl+C first and restart it afterwards (What a render does, and why two renders collide).
- The inline code (the top attraction, its visits and the total) updates at the next render, not when the file is saved. The word “ten” is typed, so it never updates (Numbers the guide computes).
- The caption says what the chart is: the measure, the year and whose attractions. The alt text says what it shows, such as which bar is longest and which shortest, for a reader who cannot see it (A chart with a caption and alt text).
- No. Both edit the same file, and both are small. Sub-agents suit independent, substantial tasks that write different files; make these two edits in turn (Sub-agents: one lead, many hands).
- Typst has a paper name for A5 but none for a 12 cm square, so the advert’s size needs a raw block, which Quarto passes to Typst untouched. A raw block ties the source to one format, so use it only for what the format’s settings cannot express (A square advert (optional)).
- Render it yourself and upload it: the pages run Python, and Quarto’s Netlify build plugin runs none. A host that builds would also find no rendered site in the repository, because
.gitignoreleaves_site/out (Where a site lives). - The flyer loads no data at all: its facts were copied into its Markdown, so a change to
attractions.csvcannot reach it. The live site shows what was last published, and changes only when you publish again (Change one input, explain the rebuild).
The second transfer task compares with 2019 because it is the last year before the pandemic years 2020 and 2021, which data/README.md says are not comparable with the others. The sight to flag is the Natural History Museum: from 2024 its count includes its reopened gardens.