3  Creating your first Quarto document

3.1 Setting up your Quarto project

  1. Create a new directory for your project.
  2. Launch VSCode
  3. Open the command palette (Ctrl-shift-P) and begin typing Quarto: Create Project
  4. Select “Book Project”
  5. Choose the Project directory you created in step 1.

This creates:

  • a simple _quarto.yml file (effectively your premable)
  • a few chapters (*.qmd)
  • a references.bib (a simple bibtex file)
Tip

You may find it useful to create a figures and chapters folder to keep your top level directory tidy.

Note

In this demo we use “Book Project” as the starting point. Alternatively, you may choose a “Default Project” (which has fewer default files) or any of the other templates.

You can visit the repo for this book to see the final structure of the project: Getting Started With Quarto

3.2 Rendering your project

3.2.1 Rendering from VSCode

You can render your project by:

  1. Open a .qmd file (e.g. index.qmd) in VSCode.
  2. Open the command palette (Ctrl-shift-P) and begin typing Quarto: Render Project
  3. Select what to render: All formats | HTML | PDF
Tip

Alternatively, you can launch a live preview which automatically updates as you edit your content. Launch Quarto: Preview or Ctrl-Shift-K

3.2.2 Rendering from the command line

You can either use the Terminal in VSCode (or just have a terminal open) and render the document from a terminal using:

quarto render
Tip

Alternatively, you can launch a live preview which automatically updates as you edit your content.

quarto preview

3.2.3 Quick preview

For a quick preview of simple markdown code, the Markdown All in One VSCode extension, will show an instant preview of any single markdown document. You can run this Preview from the VSCode command palette of Ctrl-Shift-V

Warning

Please note the quick preview is just a simple markdown display preview (it won’t know about references, figures, code) and doesn’t rebuild your whole project, but can be useful for quick previews to check things look roughly right.

Note

Congratulations, you’ve built your first Quarto project! In the following chapters we will learn how to add content.