Introduction
A .qmd file is a document for Quarto,
an open-source publishing system from Posit, the company behind RStudio. Like
R Markdown, which it follows on from, it is Markdown
text with cells of code that run when the document is rendered, but it is not tied to
R: cells can be Python, R, Julia or Observable JavaScript. One source can become a web
page, a PDF, a Word document, slides, a book or a whole website.
Structure
A Quarto document is plain text. A YAML header between two lines of ---
sets the title, the output formats and other options. The body is Pandoc Markdown.
Code cells are fenced with three backticks and the language in braces, such as
{python}. Options for a cell are written inside it as comments starting
#|, so the cell is still valid code.
Quarto runs Python and Julia cells with a Jupyter kernel and R cells with knitr, then
passes the result to Pandoc. The results are not saved in the .qmd file.
The front matter, every cell option, cross-reference prefixes and shortcodes are on
the document syntax page.
---
title: "Squares"
format: html
---
```{python}
#| echo: false
print([n * n for n in range(5)])
```
Not described
Known, not yet covered
- Reference: the option lists of each output format (several hundred options in Quarto’s reference) and the knitr cell options, for the syntax page.
- Viewer: there is no viewer for Quarto documents yet.
Links
Software
- Quarto – the publishing system;
quarto renderandquarto previewbuild documents (Windows, macOS, Linux) - RStudio – Posit’s IDE for R, which edits and renders Quarto documents (Windows, macOS, Linux)
- Positron – Posit’s data science IDE for Python and R (Windows, macOS, Linux)
- Visual Studio Code – code editor that edits and previews them with the Quarto extension (Windows, macOS, Linux)
Reference
- Quarto Guide – the official documentation