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.
---
title: "Squares"
format: html
---
```{python}
#| echo: false
print([n * n for n in range(5)])
```
Links
Software
- Quarto, whose
quarto renderandquarto previewbuild it (Windows, macOS, Linux) - RStudio (Windows, macOS, Linux)
- Positron (Windows, macOS, Linux)
- Visual Studio Code, with the Quarto extension (Windows, macOS, Linux)
Reference
- Quarto Guide, the official documentation