Your first Quarto document

An example lesson built with quarto-simulator

A complete lesson: a free playground and four graded exercises on YAML, callouts, code cell options, cross-references and Python.
NoteAbout this page

This is what a lesson looks like to a learner. Its source is vignettes/example-lesson.qmd. The other vignettes explain how each part is written.

A Quarto document is plain text with three parts: a YAML header that sets document options, markdown prose, and code cells that run when the document renders.

Each playground below has an editor on the left and the rendered document on the right. The preview is a simulation of Quarto that runs in your browser, made for practising the basics. Edit the text, then press ▶ Render (or Ctrl/Cmd + Shift + K, the same shortcut RStudio uses) to see the result. Everything runs in your browser.

Explore

Try changing the title, adding toc: true to the YAML header, or changing cars to pressure in the code cell.

Exercise 1: Document options and callouts

The YAML header controls how the whole document renders. Update this document so that:

  1. It has a table of contents.
  2. The sentence about practice is inside a tip callout.

Exercise 2: Code cell options

Cell options start with #| and go at the top of a code cell. Change the cell so that:

  1. The code is hidden and only the plot shows.
  2. The plot is a cross-referenceable figure: give it a label starting with fig- and a caption.
  3. The sentence below the cell refers to the figure with @.

Exercise 3: Fix the YAML

YAML is strict about indentation and punctuation. This document won’t render. Press ▶ Render, read the error message, and fix the header.

Exercise 4: Python cells

Python cells work too. Quarto runs them with Jupyter; here they run with Python in your browser. Change the document so that:

  1. The table is a cross-referenceable table: give the cell a label starting with tbl- and a tbl-cap.
  2. The ??? is replaced by inline Python code that computes the average score, rounded to one decimal place.