Skip to main content

Whole game

Before you learn any part of Quarto in depth, it helps to see how all the parts fit together. In this part of the book, you play the “whole game”: you take one document from an empty file to a page on the web that anyone can read. You do each step in its simplest form. The later parts of the book come back to each step and go deeper.

We borrow the name from R for Data Science (Wickham et al. 2023), which starts in the same way. The idea is that you learn a game faster when you play a simple version of the whole game than when you practice each skill alone. When you know where each piece fits, the details in the rest of the book are easier to understand and remember.

The game

Whatever you make with Quarto, you follow the same cycle:

flowchart LR
  W[Write] --> P[Preview]
  P -->|edit| W
  P --> R[Render]
  R --> S[Publish]

  1. Write a .qmd file: a document header, Markdown text, and, if you like, code.
  2. Preview the output, make changes, and preview again. You spend most of your time in this loop.
  3. Render the final output.
  4. Publish the output so other people can read it.

Each chapter in this part adds one piece to this cycle:

  • In 1  Quarto, you learn what Quarto is, install it, and meet the three components of a Quarto document.
  • In 2  Your Quarto workflow, you write, preview and render a short document, from the command line and in an IDE like Positron or RStudio.
  • In 3  Writing content, you learn enough Markdown to write the content of a document.
  • In 4  Adding code, you add code cells and inline code, so that the results in your document update when your data changes. If you don’t plan to include code in your documents, you can skip this chapter.
  • In 5  Setting options, you control how your document looks and behaves with options in the document header and in code cells.
  • In 6  Sharing your work, you publish your document to the web with quarto publish, and learn how to share its source.

At the end of 6  Sharing your work, you have played the whole game once.

The running example

The chapters in this part use the same example: Sam Okafor’s report on how early Mochi the cat wakes the household before the alarm each morning in February. Mochi, Sam, and the data are fictional, but the photo of Mochi is of a real cat named Scylla.

The report starts in 2  Your Quarto workflow as a short document with no code, mochi.qmd. Each chapter adds to it: more Markdown, code that summarizes and plots the data, and options that change its appearance. In 6  Sharing your work, you publish it.

How to read this part

Read this part in order, from start to finish. Each chapter builds on the previous chapters, and the later parts of the book assume you know the material here.

If you have used Quarto before, you can skim this part. You’ll see the vocabulary that we use in the rest of the book, and you might find some useful features of the tools you already use.