page_content
stringlengths 0
33.5k
| metadata
dict |
---|---|
Goals
The overarching goal of Quarto is to make the process of creating and collaborating on scientific and technical documents dramatically better. We hope to do this in several dimensions:
Create a writing and publishing environment with great integrated tools for technical content. We want to make authoring with embedded code, equations, figures, complex diagrams, interactive widgets, citations, cross references, and the myriad other special requirements of scientific discourse straightforward and productive for everyone.
Help authors take full advantage of the web as a connected, interactive platform for communications, while still providing the ability to create excellent printed output from the same document source. Researchers shouldn’t need to choose between LaTeX, MS Word, and HTML but rather be able to author documents that target all of them at the same time.
Make reproducible research and publications the norm rather than the exception. Reproducibility requires that the code and data required to create a manuscript are an integrated part of it. However, this isn’t often straightforward in practice—Quarto aims to make it easier to adopt a reproducible workflow than not.
Quarto is open source software licensed under the GNU GPL v2. We believe that it’s better for everyone if the tools used for research and science are free and open. Reproducibility, widespread sharing of knowledge and techniques, and the leveling of the playing field by eliminating cost barriers are but a few of the shared benefits of free software in science.
Project
At the core of Quarto is Pandoc, a powerful and flexible document processing tool. Quarto adds a number of facilities to Pandoc aimed at scientific and technical publishing, including:
Embedding code and output from Python, R, and JavaScript via integration with Jupyter, Knitr, and Observable.
A variety of extensions to Pandoc markdown useful for technical writing including cross-references, sub-figures, layout panels, hoverable citations and footnotes, callouts, and more.
A project system for rendering groups of documents at once, sharing options across documents, and producing aggregate output like websites and books.
Development of Quarto is sponsored by Posit, PBC, where we previously created a similar system (R Markdown) that shared the same goals, but was targeted principally at users of the R language. The same core team works on both Quarto and R Markdown:
J.J. Allaire (@jjallaire)
Christophe Dervieux (@cderv)
Carlos Scheidegger (@cscheid)
Charles Teague (@dragonstyle)
Yihui Xie (@yihui)
With Quarto, we are hoping to bring these tools to a much wider audience.
Quarto is a registered trademark of Posit. Please see our trademark policy for guidelines on usage of the Quarto trademark.
Contribute
You can contribute to Quarto in many ways:
By opening issues to provide feedback and share ideas.
By submitting Pull Request (PR) to fix opened issues
By submitting Pull Request (PR) to suggest new features (it is considered good practice to open an issue for discussion before working on a pull request for a new feature).
Please be mindful of our code of conduct as you interact with other community members.
Pull Requests
Pull requests are very welcome! Here’s how to contribute via PR:
Fork the repository, clone it locally, and make your changes in a new branch specific to the PR. For example:
Terminal
# clone your fork
$ git clone https://github.com/<username>/quarto-cli
# configure for your platform (./configure.sh or ./configure.cmd for windows)
$ cd quarto-cli
$ ./configure.sh
# checkout a new branch
$ git checkout -b feature/newthing
For significant changes (e.g more than small bug fixes), ensure that you have signed the individual or corporate contributor agreement as appropriate. You can send the signed copy to [email protected].
Submit the pull request. It is ok to submit as draft in your are still working on it but would like some feedback from us. It always good to share in the open that you are working on it.
We’ll try to be as responsive as possible in reviewing and accepting pull requests. | {
"lastmod": "2023-07-05T19:35:15.135Z",
"loc": "https://quarto.org/about.html",
"source": "https://quarto.org/about.html"
} |
Overview
The structure of a Quarto book can be as simple as a list of chapters, or can alternatively incorporate multiple parts and/or appendices. Quarto book chapters and sections are automatically numbered (for cross-referencing), however you can also specify that some parts of the book should remain unnumbered.
The simple book configuration generated by quarto create-project illustrates the basics:
book:
title: "mybook"
author: "Jane Doe"
date: "5/9/2021"
chapters:
- index.qmd
- intro.qmd
- summary.qmd
- references.qmd
The index.qmd file is required (because Quarto books also produce a website in HTML format). This page should include the preface, acknowledgements, etc. and headings in the index.qmd file are unnumbered by default. The HTML version of the book will use the index.qmd as the home page and if provided, will place the cover-image on that page.
The remainder of chapters includes one or more book chapters.
The references.qmd file will include the generated bibliography (see References below for details).
Titles
Since rendering options are provided in _quarto.yml, you’ll typically see a simple level-one header at the top of chapters. For example:
# Introduction
Note that the following is also still perfectly valid:
---
title: "Introduction"
---
Chapter Numbers
All chapters are numbered by default. If you want a chapter to be unnumbered simply add the .unnumbered class to its main header. For example:
# Resources {.unnumbered}
You can mix together numbered and unnumbered chapters. Note however that while you can link to unnumbered chapters, you can’t cross reference figures, tables, etc. within them. Unnumbered chapters are therefore mostly useful for prefatory content or references at the end of your book.
Section Numbers
You can set the numbering depth via the number-depth option. For example, to only number sections immediately below the chapter level, use this:
number-depth: 1
Note that toc-depth is independent of number-depth (i.e. you can have unnumbered entries in the TOC if they are masked out from numbering by number-depth).
References
You should include a div with the id #refs at the location in your book where you’d like the bibliography to be generated. For example the references.qmd file generated by quarto create-project includes this:
# References {.unnumbered}
::: {#refs}
:::
Note that you can change the chapter title to whatever you like, remove .unnumbered to have it be numbered like other chapters, and add other content before or after the bibliography as necessary.
Creating an Index
For PDF output, you can create an index using the LaTeX makeidx package along with the \index command.
To add an index to the PDF output for a book, add these include-in-header and include-after-body entries to your pdf format configuration in _quarto.yml: quart
format:
html:
theme: cosmo
pdf:
documentclass: scrreprt
include-in-header:
text: |
\usepackage{makeidx}
\makeindex
include-after-body:
text: |
\printindex
Then, add \index{entry} commands wherever you want an index entry. For example:
Markdown\index{Markdown} allows you to write using
an easy-to-read, easy-to-write plain text format.
Note that \index commands are automatically ignored for non-PDF output.
Parts & Appendices
Please Note
Note that EPUB and Word (Docx) formats do not currently support organizing books into parts. When rendering a book with parts to these formats, the parts will be ignored.
You can divide your book into parts using part within the book chapters. For example:
chapters:
- index.qmd
- preface.qmd
- part: dice.qmd
chapters:
- basics.qmd
- packages.qmd
- part: cards.qmd
chapters:
- objects.qmd
- notation.qmd
- modifying.qmd
- environments.qmd
Note that the markdown files dice.qmd and cards.qmd contain the part title (as a level one header) as well as some introductory content for the part. If you just need a part title then you can alternatively use this syntax:
- part: "Dice"
chapters:
- basics.qmd
- packages.qmd
You can include appendices by adding an appendices key to your book config. For example:
book:
title: "mybook"
author: "Jane Doe"
date: "5/9/2021"
chapters:
- index.qmd
- intro.qmd
- summary.qmd
- references.qmd
appendices:
- tools.qmd
- resources.qmd
Parts and appendices show up like this in HTML output:
In LaTeX output, the \part command is used for parts. In EPUB and MS Word output parts are ignored entirely.
Appendices are numbering using uppercase alpha, and have a prefix inserted into their title to indicate they are an appendix (e.g. “Appendix A — Additional Resources”). You can customize the prefix and delimiter using the following options:
crossref:
appendix-title: "App."
appendix-delim: ":"
Which would result in the above example being output as: “App. A: Additional Resources”.
Page Navigation
If you have a book with several pages in a section or subsection, it is often convenient to offer the user the ability to navigate to the next page (or previous page) at the bottom of the page that they’ve just finished reading. You can enable this using:
book:
page-navigation: true
When enabled, page navigation will be displayed at the bottom of the page whenever there is a next or previous page (including in the next or previous section). This option is enabled by default for books but not for websites. | {
"lastmod": "2023-07-05T19:35:15.255Z",
"loc": "https://quarto.org/docs/books/book-structure.html",
"source": "https://quarto.org/docs/books/book-structure.html"
} |
Overview
One important difference between creating a website and a book is that in addition to their web output, books can also be rendered as a single continuous document (e.g a PDF or MS Word document). Books also may or may not be read digitally (which means that internal hyperlinks may or may not be available).
To create books that are consumable in all of these mediums, special care should be taken when creating links to other chapters or sections within chapters (note though that if your book targets only HTML output you can feel free to use conventional hyperlinks).
Quarto cross references provide automatic numbering and reference creation for figures, tables, equations, sections, listings, theorems, and proofs. In books, cross references work the same way except they can reach across chapters.
If you aren’t already familiar with using crossrefs you may want to read the documentation on cross references before reading on about how they work with books.
Creating References
To reference a figure, table, or other cross-referenceable entity, use the @ syntax (similar to citations) along with the ID / label of the entity you are referencing: For example:
See @fig-penginus-by-island for a breakdown by island.
References made this way will be automatically resolved across chapters (including the requisite chapter number in the reference).
To make a chapter or section reference-able, you add a #sec prefix to its main heading. For example:
# Introduction {#sec-introduction}
Label Prefix
In order for a chapter to be cross-referenceable, its label must start with the sec- prefix.
To refer to a section, include a cross-reference to it using an @ identifier as we did above in the figure example:
See @sec-introduction for additional discussion.
To refer to a chapter or appendix explicitly you should spell out “Chapter” or “Appendix” and use the number-only form of cross reference:
See [Chapter -@sec-visualization] for more details on visualizing model diagnostics.
Section Numbers
By default, all headings in your document create a numbered section. You customize numbering depth using the number-depth option. For example, to only number sections immediately below the chapter level, use this:
number-depth: 2
Note that toc-depth is independent of number-depth (i.e. you can have unnumbered entries in the TOC if they are masked out from numbering by number-depth).
Chapter Numbering
In books, figures, tables and other cross-reference targets automatically include a chapter number. For example, the following markdown located in Chapter 3 of your book:
As illustrated in @fig-geo-comparison, the western states have a much higher incidence of forest fires.
Might be rendered as:
As illustrated in fig. 3.2, the western states have a much higher incidence of forest fires.
Note that while books do support unnumbered chapters, you naturally cannot create cross-references to content in chapters without numbers.
Hyperlinks
If you are creating an HTML-only book (or a PDF / MS Word book that you don’t expect will be printed) then you can feel free to use normal hyperlinks rather than section cross-references.
To create a hyperlink within a book, provide the source file as the link target. You can also add hash identifiers (#) to the source file if you want to link to a particular section in the document. For example:
[about](about.qmd)
[about](about.qmd#section)
Using the source file as the link target ensures that links will be resolved correctly both for HTML output and for formats that produce a single file (e.g. PDF or MS Word).
Note that if you are targeting printed output for your book you should use explicit cross references to other chapters and sections rather than simple links as shown above. This is because In printed output links aren’t navigable so you need to provide readers with numbered references (e.g. “sec. 5.3”) rather than hyperlinks. | {
"lastmod": "2023-07-05T19:35:15.255Z",
"loc": "https://quarto.org/docs/books/book-crossrefs.html",
"source": "https://quarto.org/docs/books/book-crossrefs.html"
} |
Overview
Listings enable you to automatically generate the contents of a page (or region of a page) from a list of Quarto documents or other custom data.
Listings are useful for creating blogs, providing navigation for large numbers of documents, or any other scenario where you’d like the contents of a page to be automatically updated as documents are added, updated, and removed.
You can enable listings on a page using the listing option in the document front matter. This will instruct Quarto to generate additional content (the ‘listings’) when the page is rendered. For example, the following YAML in the front matter of a document:
---
title: "Listing Example"
listing: default
---
Will result in a listing of all documents in the directory (with the exception of the current document). It might look something like this:
Listing Contents
You can control what documents are included in the listing by using the contents option, which allows you to provide a set of input files (or globs of input files) that should be included in the listing. For each of the inputs that matches the contents of a listing, an item will be included using the metadata in the front matter of the document. Please note: to have an item in the list, it must contains at least the “title” metadata.
For example to include all the Quarto documents in the posts directory, you would write:
---
title: "Listing Example"
listing:
contents: posts
---
You can write much more complex rules for including content by using globs and using a list of targets in the contents, such as:
---
title: "Listing Example"
listing:
contents:
- "reports/*.qmd"
- "lab-notes/*reports.qmd"
Review the Quarto Glob Reference for more information about supported glob syntax.
Note
If you provide a path to a directory, it will be treated as <directory>/** - the directory will be searched recursively for project inputs.
It is important to note that when providing a list of targets, these will be identified relative to the location of the listings page, not the root of the project file. For example, if your listings page is located at /pages/listings.qmd specifying contents: "reports/*.qmd" will search in /pages/reports/ not /reports/ for the targeted files.
In addition to specifying lists of files or globs, contents can contain lists of metadata as well. For more about this, see Custom Listings.
Listing Types
There are three built in types of listings that you can choose from. Use the type option to choose the appearance of the listing:
---
listing:
contents: posts
type: default
---
The type field accepts the following values:
Type
Description
default
A blog style list of items.
table
A table of listings.
grid
A grid of listing cards.
DefaultGridTable
By default, listings will appear in full width rows that display the item’s metadata (author and date), title, description, and image.
Grid style listings display a card for each item.
The table listing style provides a traditional tabular layout.
Sorting Items
By default, listings created from documents will be ordered by their title. Use the sort option to control the order of the listing. For example:
listing:
contents: posts
sort: "date"
Each sort key in can include a field name and optionally either asc or desc to control whether to sort in ascending or descending order. When only the name is specified, sorting by that field will be in ascending order.
The sort key can also contain one or more fields to sort by. For example:
listing:
contents: posts
sort:
- "date"
- "title desc"
This will sort the documents in the post directory first by their date in ascending order, then by their title in descending order.
If you’d like to disable sorting entirely and display the items in the order in which they are specified, you can pass sort: false which will disable sorting and preserve the item’s original order.
Listing Options
It is possible to customize the appearance of listings using the following options for each type of listing display.
Default
Option
Description
max-items
The maximum number of items to include in this listing.
image-align
Whether to place the image on the right or left side of the post content. Defaults to right.
image-height
The height of the image being displayed. The width is automatically determined and the image will fill the rectangle without scaling (cropped to fill).
image-placeholder
The default image for items if they have no image.
Grids
Option
Description
max-items
The maximum number of items to include in this listing.
image-height
The height of the image being displayed. The width is automatically determined and the image will fill the rectangle without scaling (cropped to fill).
image-placeholder
The default image for items if they have no image.
grid-columns
The number of columns in the grid display. Defaults to 3.
grid-item-border
Whether to display a border around the item card. Defaults to true.
grid-item-align
Aligns the content within the card (left, right, or center). Defaults to left.
Tables
Options
Description
max-items
The maximum number of items to include in this listing.
image-height
The height of the image being displayed. The width is automatically select and the image will fill the rectangle without scaling (cropped to fill).
image-placeholder
The default image for items if they have no image.
table-striped
Display the table rows with alternating background colors (true or false). Defaults to false
table-hover
Highlight rows of the table when the user hovers the mouse over them (true or false). Defaults to false.
field-links
A list of fields that should link to the document in the table (defaults to title).
Advanced Options
Option
Description
field-display-names
A mapping that provides display name for specific fields. For example, to display the title column as ‘Report’ in a table listing you would write:
listing:
field-display-names:
title: "Report"
max-description-length
The maximum length of the description displayed in the listing (in characters). Defaults to 175.
date-format
The date format to use when displaying dates (e.g. d-M-yyyy).
You may either provide a date style (full, long, medium, or short) or a format string for formatting the date. The behavior of date styles varies depending upon locale, but examples in the en locale are as follows:
full
Saturday, February 5, 2022
long
February 5, 2022
medium
Feb 5, 2022
short
2/5/22
Learn more about supported date formatting values here.
In addition to the above listing wide options, each listing type has a variety of options to customize its appearance.
Categories
In addition to displaying the listing contents, listings can also automatically add a list of categories to the page that they appear on. To enable categories you can set the categories option like:
listing:
categories: true
which results in categories appearing in the right sidebar:
When users click a category, the page will be updated to show only the listing items that match the selected category.
Category Appearance
You can choose between a few different display styles for categories:
Option
Description
numbered
Displays a list of categories in alphabetical order with the number of items in that category displayed next to the category name.
unnumbered
Display a list of categories in alphabetical order.
cloud
Displays a ‘word cloud’ of categories.
When multiple listings appear on the page, categories will be enabled based upon the option set in the first listing. If categories are enabled for the first listing, all listings on the page will contribute their item categories to the list of categories and all will be filtered when the user clicks a category.
Feeds
You can also have an RSS feed generated based upon the contents of a listing. This is great to allow your content to be syndicated or to be accessible via RSS Readers. Include a feed for your listing by including the feed option:
listing:
contents: posts
feed: true
When a feed is enabled for a listing on a page, an RSS file will automatically be generated using the name of the the file. For example, index.qmd will produce a feed at index.xml. A link to the feed will be included in the head of the page as well.
Generating feeds requires that the site-url be set for the site in your _quarto.yml file. For example:
website:
site-url: "https://www.quarto.org"
You can further customize your feed using the following options:
Option
Description
items
The number of items to include in your feed. Defaults to 20.
type
full or partial. full, the default, includes the full contents of each document in the feed. partial includes only the first paragraph contents in the feed.
title
The title for this feed. Defaults to the site title provided in your _quarto.yml file.
image
The image for this feed. If not specified, the image for the page the listing appears on will be used, otherwise an image will be used if specified for the site in your _quarto.yml file.
description
The description of this feed. If not specified, the description for the page the listing appears on will be used, otherwise the description of the site will be used if specified in your _quarto.yml file.
language
The language of the feed. Omitted if not specified. See https://www.rssboard.org/rss-language-codes for a list of valid language codes.
categories
Generates a separate feed for each of the categories included in this list of category names.
Listing Fields
When reading the contents of a listing, Quarto uses the metadata read from the front matter of the document or the contents of the document itself to populate the following fields for each item:
Field Name
Description
title
The title of the item, read from the title field of the front matter (or the first H1 of the document).
subtitle
The subtitle of the item, read from the subtitle field of the front matter.
author
The author of the item, read from the author field of the front matter.
description
The description of the item, read from the description or abstract field of the front matter or from the first paragraph of the document.
date
The date of the item, read from the date field of the front matter.
image
The image for this item, read from the image field of the front matter, or automatically discovered by taking the first of an image of class preview-image, an image with a file name starting with feature, cover, or thumbnail, or the first image to appear in the document.
image-alt
The alt text for the image for this item.
reading-time
An estimate of the reading time for this item, computed by counting the words in the item and assuming a reading speed of 200 words per minute.
categories
Categories for the item, read from the categories field of the front matter.
filename
The name of the input file.
file-modified
The last modified date of this input file.
Depending upon the type of listing that you are using, different fields are displayed automatically:
Field
Type: Default
Type: Table
Type: Grid
title
x
x
x
subtitle
x
author
x
x
x
description
x
x
date
x
x
x
image
x
x
Customizing Fields
Though specific columns are displayed by default, each of the types will allow you to display any of the above columns by using the fields options. For example, to display more fields in a table (as columns), you write:
listing:
type: table
contents: posts
fields: [image, date, title, author, reading-time]
which produces:
Table with custom list of fields
Each type of listing will handle the fields in different ways.
Tables
For table type listings, the list of fields will be displayed as columns in the order that the fields appear in the list.
Default
For default type listings, the various fields will be placed logically, with the image in the right column, the title, subtitle, and description in the center column, and any other fields in the left column.
Grid
For grid listings, the image, title, subtitle, reading-time, categories, description, author, and date fields will be arranged on the body of the card. The filename and file-modified fields will appear in the card footer. Any other fields will appear in a table at the bottom of the card body.
Including or Excluding Items
You can control what documents are included or excluding based upon the metadata of the items by using the include and exclude options. These options allow you to specify one or more field names and values that must be present or absent in order for the item to be included or excluded. For example, to include only items authored by Harlow or Tristan, you write:
listing:
contents: posts
type: grid
include:
author: "{Harlow,Tristan}*"
To exclude any items authored by Charles, you write:
listing:
contents: posts
type: grid
exclude:
author: "Charles*"
When including or excluding items based upon a string field value, Quarto will use glob syntax when comparing values. Any other type of comparison will be done by testing for equality.
User Tools
Listings support interactive tools to allow the viewer of the listing to sort, filter, or page through listings.
Sorting
Users can use the select box to choose how to sort the items in the listing (or in the case of tables, by clicking on the column headings). By default, the sorting control will allow the user to sort by title, date, or author. You can stop this UI from being displayed to the user with the option:
listing:
sort-ui: false
You can control which fields are included in the sort list by providing a list of field names in the sort-ui key:
listing:
sort-ui: [title, date]
Filtering
Listings include a filter box positioned on the top right of the listing content. The filter box allows readers to perform a ‘typeahead’ search of the listing contents. You can disable the filtering control using the option:
listing:
filter-ui: false
By default, if the filtering control is enabling, all fields that are being displayed in the listing will be searchable. If you’d like to limit searching / filtering to specific fields, you can do so by providing a field list in the filter-ui key:
listing:
filter-ui: [title, date]
Pagination
Listings also natively support pagination of the items. The default number of items displayed on a page depends up the listing type:
Listing Type
Items Per Page
default
25
table
30
grid
18
You can control the number of items displayed per page using the option page-size:
listing:
page-size: 36
Listing Location
By default, listings will simply be appended to the main content region of the page. If you’d like to control where a listing appears, set an id for that listing and use that id on a corresponding div in the page. For example, updating the page used in the previous example to this:
---
title: "Listing Example"
listing:
id: sample-listings
contents: posts
sort: "date desc"
type: table
---
You can review the following documents for additional information:
::: {#sample-listings}
:::
Learn more about Quarto [here](https://www.quarto.com).
Results in a listing page like:
Multiple Listings
You can place any number of listings on a single page. The following would populate two listings on a single page:
---
title: Team Documents
listing:
- id: lab-reports
contents: "lab-reports/*.qmd"
type: table
- id: meeting-notes
contents: "meeting-notes/*.qmd"
type: table
---
## Lab Reports
:::{#lab-reports}
:::
## Meeting Notes
:::{#meeting-notes}
:::
YAML Listing Content
In addition to populating a listing with inputs that match one more globs, you can also provide items explicitly via a YAML file. For example, the following listing:
---
title: "Listing Example"
listing:
id: sample-listings
contents:
- posts
- archived-items.yaml
sort: "date desc"
type: table
---
will include all the documents in the posts directory, but will also merge in the contents of the archived-items.yaml file. The contents of the archived-items.yaml file should be a list of items, each of which is a map of field names to values. For example:
- title: "Archived Item 1"
author: Norah Jones
date: 2020-01-01
href: "archived/archived-item-.html"
categories: [archived, technology]
This is useful for cases such as migrating existing content to Quarto- you can begin creating new content as Quarto documents, but still include existing content in your listings by providing their metadata via a yaml file. | {
"lastmod": "2023-07-05T19:35:16.031Z",
"loc": "https://quarto.org/docs/websites/website-listings.html",
"source": "https://quarto.org/docs/websites/website-listings.html"
} |
Overview
In addition to the 3 built in types of listings, you can also build a completely custom display of the items. This custom display can generate any HTML and can optionally still take advantage of the sorting, filtering, and pagination provided by listings.
Listing Templates
To build a custom listing display, you create an EJS template that will be used to generate the HTML for a set of items that are passed to the template. EJS templates allow to generate HTML using plain javascript, making it easy to loop through items and output their values in your custom HTML.
To use a custom template, pass it in the template option for a listing:
listing:
template: gallery.ejs
When a listing with a custom template is rendered, the listing contents will be read and processed into a set of items that are passed to the template for rendering. For example, in this case, all the documents in the posts directory will be read into items and passed to the gallery.ejs template.
listing:
contents: posts
template: gallery.ejs
A simple template for outputing a list of documents might look like:
<ul>
<% for (const item of items) { %>
<li><a href="<%- item.path %>"><%= item.title %></a></li>
<% } %>
</ul>
which produces simple HTML output like:
When rendered, the above template will receive an array of listing items called items. When the contents of a listing are loaded from a list of documents, each of those items will be populated with the fields described in Listing Item Fields. In addition, any other fields included in a documents metadata will be passed as a property of the item, making it possible to use custom metadata in your documents and the listing display.
Metadata Listings
The contents option for a listing most commonly contains a list of paths or globs, but it can also contain metadata. When contents are metadata, the metadata will be read into items and passed to the template. For example:
listing:
template: custom.ejs
contents:
- name: First Item
href: https://www.quarto.org
custom-field: A custom value
- name: Second Item
href: https://www.rstudio.org
custom-field: A second custom value
could be rendered using:
```{=html}
<ul>
<% for (const item of items) { %>
<li>
<a href="<%- item.href %>"><%= item.name %></a><br/>
<%= item['custom-field'] %>
</li>
<% } %>
</ul>
```
which produces a simple HTML display like:
Metadata File Listings
The contents option for a listing can also point to one or more yaml files (which contain metadata). In that case, the metadata will be read from the files into items and passed to the template. For example:
listing:
template: custom.ejs
contents:
- items.yml
where the contents of items.yml is:
- name: First Item
href: https://www.quarto.org
custom-field: A custom value
- name: Second Item
href: https://www.rstudio.org
custom-field: A second custom value
Template Examples
Portions of this website are built using custom listings. The best place to start is with our gallery, which is a listing built using a custom template and a metadata file. You can view the source code used to create the gallery page in our Github repository.
File
Description
gallery.yml
The metadata that controls what items are displayed in the gallery listing.
gallery.ejs
The template used to display the items on the page.
index.qmd
The Quarto document that configures and positions the listing in the #gallery div.
Sorting, Filtering, and Pagination
By default, sorting, filtering, and pagination are disabled for custom listings templates, but with some simple changes to your template and listing options, you can add this capability to your custom listing. To do this, you need to include the following three things in your custom template:
Include a list class on the HTML tag that contains the list of items.
For each item, include <%= metadataAttrs(item) %> in the HTML tag that contains the item. This will allow Quarto write custom attributes that are used for sorting and filtering.
Within each item, include a class that identifies the tag whose text represents the contents of an item’s field. The class must be the name of the field prefixed with listing-, for example the tag whose inner text is the item.name should include a class listing-name.
For example, we can modify the above custom.ejs template as follows:
<ul class="list">
<% for (const item of items) { %>
<li <%= metadataAttrs(item) %>>
<a href="<%- item.href %>" class="listing-name"><%= item.name %></a><br/>
<span class="listing-custom-field"><%= item['custom-field'] %><span>
</li>
<% } %>
</ul>
Once you have included these items in your template, can you then enable the options in your listing:
listing:
sort-ui: true
filter-ui: true
page-size: 10
The UI elements will now appear on the page and should interact properly with your custom listing.
Field Display Names
You may want to provide a custom display name for your field to provide a better name than the field name. For example, the field name would appear in the sort UI. You can use field-display-names to create mapping from a field to a display name. For example:
listing:
template: custom.ejs
contents:
- items.yml
sort-ui: true
filter-ui: true
page-size: 10
field-display-names:
name: "Name"
custom-field: "Custom"
Date Sorting and Formatting
To properly format and sort date values, you can specify type information for fields in your items. If you specify a field is a date, it will automatically be formatted using the specified date formatting (either default or specified using date-format) and will support date sorting in ascending or descending order. If you specific a field as a number, it will support ascending and descending numeric sorting.
You can specify field types as follows:
listing:
template: custom.ejs
contents:
- items.yml
field-types:
custom-date: date
custom-number: number
Required Fields
Since listings are generated using fields that are specified in other documents or via metadata, it can be helpful to ensure that required fields are present. You can note required fields as following:
listing:
template: custom.ejs
contents:
- items.yml
field-required: [name, custom-field]
If the listing page is rendered and any of contents are missing a value for either of the required fields, an error will be thrown noting the field that is required and the file or metadata that has omitted it.
Template Parameters
You may also make your custom template more dynamic by using parameters to control it’s behavior. You can provide parameters for custom templates using the template-params option like:
listing:
template: custom.ejs
contents:
- items.yml
template-params:
param1: "param-value"
Template parameters can then be accessed in your template using <%= params.param1 %>. For example, we can modify the above custom.ejs template as follows:
<h3><%= templateParams.param1 %></h3>
<ul class="pub-list list">
<% for (const item of items) { %>
<li <%= metadataAttrs(item) %>>
<span class="listing-title"><%= item.title %>.</span>
</li>
<% } %>
</ul> | {
"lastmod": "2023-07-05T19:35:16.031Z",
"loc": "https://quarto.org/docs/websites/website-listings-custom.html",
"source": "https://quarto.org/docs/websites/website-listings-custom.html"
} |
Overview
Quarto websites include integrated support for blogging. Blogs consist of a collection of posts along with a navigational page that lists them in reverse chronological order. Blogs can include a custom about page, publish an RSS feed, and use a wide variety of themes.
You can create websites that consist entirely of a single blog, websites that have multiple blogs, or you can add a blog to a website that contains other content.
Quick Start
Follow the Quick Start for your tool of choice to get a simple blog up and running. After covering the basics, read on to learn about more advanced blog features.
VS CodeRStudioTerminal
To create a new blog project within VS Code, execute the Quarto: Create Project command from the command-palette:
Then, select Blog Project:
You’ll be prompted to select a parent directory to create the project within. Then, you’ll be asked to name the directory for your blog project:
The new blog project will be created and opened within VS Code. Click the Render button to preview the blog:
The preview will show to the right of the source file. As you re-render index.qmd or render other files like about.qmd, the preview is automatically updated.
To create a new blog project within RStudio, use the New Project command and select Quarto Blog:
Then, provide a directory name and other relevant options for the blog:
Click the Render button to preview the blog:
The preview will show to the right of the source file. As you re-render index.qmd or render other files like about.qmd, the preview is automatically updated.
To create a new blog project from the Terminal, use the quarto create-project command with --type website:blog, specifying the directory that will hold the new project as first argument:
Terminal
quarto create-project myblog --type website:blog
This will create the scaffolding for a simple blog in the myblog sub-directory. Use the quarto preview command to render and preview the blog:
Terminal
quarto preview myblog
The blog preview will open in a new web browser. As you edit and save index.qmd (or other files like about.qmd) the preview is automatically updated.
Here’s a summary of the key files created within the starter blog project:
File
Description
_quarto.yml
Quarto project file.
index.qmd
Blog home page.
about.qmd
Blog about page.
posts/
Directory containing posts
posts/_metadata.yml
Shared options for posts
styles.css
Custom CSS for website
In the following sections we’ll take a closer look at the various components of the project.
Home Page
The home page is a listing page for all of the documents in the posts directory:
Here’s the source code for the home page:
---
title: "myblog"
listing:
contents: posts
sort: "date desc"
type: default
categories: true
---
When you render a new post, the listing page will automatically updated, adding the most recent post to the top of the list.
Warning
It is not recommended that you use dynamic dates (for example today or last-modified) in your blog posts. This will cause the order of your blog and feed to be changed each time the document is rendered or modified.
See the article on Listing Pages to learn more about customizing listings, including use a grid layout rather than the default shown above.
Categories
The listing page is configured to enable categories, which display in the right margin of the page:
---
title: "myblog"
listing:
# (additional metadata excluded for brevity)
categories: true
---
The categories are read from the front matter of documents included in the listing. For example, here is sample post metadata that includes categories:
---
title: "Post With Code"
description: "Post description"
author: "Fizz McPhee"
date: "5/22/2021"
categories:
- news
- code
- analysis
---
See the article on Categories to learn more.
About Page
The about.qmd document includes additional information on the blog and its author. For example:
Here’s what the source code of an about.qmd might look like:
---
title: "About"
image: profile.jpg
about:
template: jolla
links:
- icon: twitter
text: Twitter
href: https://twitter.com
# (additional links excluded for brevity)
---
## About this blog
This is the contents of the about page for my blog.
See the article on About Pages to learn about the various options available for customizing page output.
Posts Directory
The posts that make up the contents of the blog are located in the posts directory.
Add a new post to your blog by creating a sub-directory within posts, and adding an index.qmd file to the directory. That qmd file is the new blog post and when you render that, the blog home page will automatically update to include the newest post at the top of the listing.
Drafts
Add draft: true to the document options if you’d like a post to not be included in the listing, site map, or site search. For example:
---
title: "My Post"
description: "Post description"
author: "Fizz McPhee"
date: "5/22/2021"
draft: true
---
To publish the post when it is complete, simply remove draft: true from the document options and then render it.
Last Updated
To indicate the date of the last modification, but preserve the original publication date, you can add the date-modified field to the document options. For example:
---
title: "My Post"
description: "Post description"
author: "Fizz McPhee"
date: "5/22/2021"
date-modified: "5/23/2021"
---
Freezing Posts
Blogs posts that contain executable code often have the problem that posts created last year can’t be rendered this year (for example, because the packages used by the post have changed). A similar problem can also arise when a blog has multiple contributors and not everyone has the right software (or the right versions) to render all of the posts. Finally, posts that include computations can often take a while to render, and you don’t want the cumulative time required to render the site to grow too large.
The solution to these problems is to freeze the output of computational blog posts. When a post is rendered with freeze: true, the markdown output from the the underlying engine (e.g. Jupyter or Knitr) is saved. When the entire site is rendered these computations are not re-run, but rather read from the previously frozen results.
The only time an article with freeze: true is rendered is when you explicitly re-render it. By specifying this option for blog posts you can ensure that posts rendered now will always re-render well with the rest of the site, even if the software required to originally render them isn’t available.
In the default blog we include a file (_metadata.yml) that establishes shared metadata for all documents within the posts directory. In this file, we specify that we want freeze: true set by default for all posts:
# options apply to all posts in this folder
# freeze computational output
freeze: true
See the article on the freeze option to learn more about freezing computational output within websites.
Themes
Blogs can use any of the 25 Bootswatch themes included with Quarto. You can also create your own themes. The default blog generated by quarto create-project uses the cosmo theme. Here are links to the available themes along with thumbnails of what the simple default blog looks like under a few of them:
default
cerulean
cosmo
cyborg
darkly
flatly
journal
litera
lumen
lux
materia
minty
morph
pulse
quartz
sandstone
simplex
sketchy
slate
solar
spacelab
superhero
united
vapor
yeti
zephyr
litera
solar
morph
RSS Feed
Blogs typically include an RSS feed that allows their content to be easily syndicated to feed readers and other websites. You can enable RSS for a blog by doing the following:
In the quarto.yml file, add a site-url and description to the website key (without these options being set in the project file, Quarto cannot generate a feed). For example:
website:
title: "myblog"
site-url: https://www.myblogexample.io
description: "A great sample blog"
In your blog home page index.qmd add the feed: true option to the listing. For example:
---
title: "myblog"
listing:
contents: posts
sort: "date desc"
type: default
categories: true
feed: true
---
Now, when your site is rendered, an RSS feed will also be generated. To learn more, see the article on RSS Feeds.
Including an RSS Link on the Navbar
You can add an RSS link to your navbar by including the following in your _quarto.yml project file. For example:
website:
title: "myblog"
site-url: https://www.myblogexample.io
description: "A great sample blog"
navbar:
right:
- icon: rss
href: index.xml
Category Feeds
You can also generate RSS feeds for specific categories in your blog. For example, to create feeds for the categories news and posts in a blog, you could write the following:
---
title: "myblog"
listing:
contents: posts
sort: "date desc"
type: default
categories: true
feed:
categories: [news, posts]
---
This will create an index.xml file with the RSS feed for the listing, but also create an index-news.xml and index-posts.xml file with RSS feeds for the respective categories.
Publishing
There are a wide variety of ways to publish Quarto blogs. Blog content is by default written to the _site sub-directory. Publishing is simply a matter of copying this directory to a web server or web hosting service.
The article on Publishing Websites describes in more detail how to publish to the following services:
Quarto Pub
GitHub Pages
Netlify
Posit Connect
Firebase
Site44
Amazon S3
Subscriptions
You may want to allow readers of your blog to subscribe to updates via email. You can use a third party email service to manage and send these emails.
Third party email services will typically take your RSS Feed as input (e.g. https://www.myblogexample.io/index.xml) and provide HTML for a subscription widget that you can place on your blog. A good place to locate that widget is often right margin of your blog.
Here are the steps required to add a subscription widget:
Use your email service features to generate the HTML for your subscription widget. MailChimp, for example, provides HTML like this for a minimal subscription widget.
<span style="font-weight: 600;">Subscribe</span>
<!-- Begin Mailchimp Signup Form -->
<link href="http://cdn-images.mailchimp.com/embedcode/slim-10_7_dtp.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; width:170px;}
/* Add your own Mailchimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
#mc-embedded-subscribe-form{margin-left:-5px;}
</style>
<div id="mc_embed_signup">
<form action="<site_url>" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_f718424fc5df77c22533bdaa6_a3c37fb57b" tabindex="-1" value=""></div>
<div class="optionalParent">
<div class="clear foot" style="margin-top: 10px;">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
<p class="brandingLogo"></p>
</div>
</div>
</div>
</form>
</div>
<!--End mc_embed_signup-->
Warning
The above widget HTML will not work in your blog as the subscription HTML needs to contain value specific to your blog. See your email service provider’s instructions for generating a subscription widget.
Create the file subscribe.html in the root of your project.
Paste the HTML for your subscription widget into subscribe.html and save the file.
Add subscribe.html to the margin-header in your _quarto.yml file:
website:
# (additional metadata excluded for brevity)
margin-header: subscribe.html
The result looks like this: | {
"lastmod": "2023-07-05T19:35:16.031Z",
"loc": "https://quarto.org/docs/websites/website-blog.html",
"source": "https://quarto.org/docs/websites/website-blog.html"
} |
Overview
Quarto makes it easy to create a simple about page for an individual or organization. When the about option is provided for a document, a special template will be used to layout the content of the current page with a custom layout designed to present a person or organization.
For example:
---
title: "Finley Malloc"
about:
template: jolla
image: profile.jpg
links:
- icon: twitter
text: twitter
href: https://twitter.com
- icon: github
text: Github
href: https://github.com
---
Finley Malloc is the Chief Data Scientist at Wengo Analytics. When not innovating on data platforms, Finley enjoys spending time unicycling and playing with her pet iguana.
## Education
University of California, San Diego | San Diego, CA
PhD in Mathematics | Sept 2011 - June 2015
Macalester College | St. Paul MA
B.A in Economics | Sept 2007 - June 2011
## Experience
Wengo Analytics | Head Data Scientist | April 2018 - present
GeoScynce | Chief Analyst | Spet 2012 - April 2018
The contents of this page will be laid out using the jolla template with the profile.jpg image, and generate a set of links for the items specified in links.
You can write and format the content of the page however you’d like - when the page is rendered, Quarto will use the content and options provided in the about option to create the about page, arranging the content content of the about option with the content in the page itself.
Templates
Quarto includes 5 built in templates, drawing inspiration from the Postcards R Package. Built in templates include:
jolla
trestles
solana
marquee
broadside
Each template will position the about elements with the content in a different layout. Select the template using the template option:
about:
template: trestles
Here is a preview of each of the templates:
jollatrestlessolanamarqueebroadside
Image
The image for the about page will be read from the document-level image option:
title: Finley Malloc
image: profile.jpg
about:
template: jolla
In addition, you can customize how the image is displayed in the page to better meet your needs by setting the following options.
option
description
templates
image-width
A valid CSS width for your image.
all
image-shape
The shape of the image on the about page. Choose from:rectangle, round, rounded
jolla, solana, trestles
image-alt
Alternative text for image
all
image-title
Title for image
all
For example:
title: Finley Malloc
image: profile.png
about:
template: trestles
image-width: 10em
image-shape: round
Links
Your about page also may contain a set of links to other resources about you or your organization. Each template will render these links in a slightly different way. Here are the options that you can specify for each link:
Option
Description
href
Link to file contained with the project or an external URL.
text
Text to display for navigation item (defaults to the document title if not provided).
icon
Name of one of the standard Bootstrap 5 icons (e.g. “github”, “twitter”, “share”, etc.).
aria-label
Accessible label for the navigation item.
Partial Page Content
By default, the about page will be generated using the entire contents of the page. If you’d like, however, you may also choose to use only a portion of the page’s content to populate the about template. In this case, you can specify an id for the about page in the document front matter. When rendering the page, Quarto will find any div with that id and use the contents of that div to populate the about template. The div that provided the contents will be replaced with the formatted ‘about’ content. For example, you could write:
---
title: "Finley Malloc"
about:
id: hero-heading
template: jolla
image: profile.jpg
links:
- icon: twitter
text: twitter
href: https://twitter.com
- icon: github
text: Github
href: https://github.com
---
### This content appears above the formatted about page content.
:::{#hero-heading}
Finley Malloc is the Chief Data Scientist at Wengo Analytics. When not innovating on data platforms, Finley enjoys spending time unicycling and playing with her pet iguana.
## Education
University of California, San Diego | San Diego, CA
PhD in Mathematics | Sept 2011 - June 2015
Macalester College | St. Paul MA
B.A in Economics | Sept 2007 - June 2011
## Experience
Wengo Analytics | Head Data Scientist | April 2018 - present
GeoScynce | Chief Analyst | Sept 2012 - April 2018
:::
### This content appears below the formatted about page content. | {
"lastmod": "2023-07-05T19:35:16.031Z",
"loc": "https://quarto.org/docs/websites/website-about.html",
"source": "https://quarto.org/docs/websites/website-about.html"
} |
Visual mode includes extensive support for Quarto features frequently used in technical writing including equations, citations, cross-references, footnotes, embedded code, and LaTeX. This article describes using these features in more depth.
Equations
LaTeX equations are authored using standard Pandoc markdown syntax (the editor will automatically recognize the syntax and treat the equation as math). When you aren’t directly editing an equation it will appear as rendered math:
As shown above, when you select an equation with the keyboard or mouse you can edit the equation’s LaTeX. A preview of the equation will be shown below it as you type.
Cross References
Cross References make it easier for readers to navigate your document by providing numbered references and hyperlinks to various entities like figures, tables, and equations.
Every cross-referenceable entity requires a label (unique identifier) and caption (description). For example, this is a cross-referenceable figure:
![Elephant](elephant.png){#fig-elephant}
The presence of the caption (“Elephant”) and label (#fig-elephant) make this figure referenceable. This enables you to use the following syntax to refer to it elsewhere in the document:
See @fig-elephant for an illustration.
Here is what this would look like rendered to HTML:
See the article on Cross References for full documentation on creating cross references and customizing their display.
Use the Insert -> Cross Reference… command to insert a cross reference:
You can also just type the prefix of a cross reference label (e.g. @fig-env) and select it via auto-complete:
Similar to hyperlinks, you can also navigate to the location of a cross-reference by clicking the popup link that appears when it’s selected:
You can also navigate directly to any cross-reference using IDE global search:
Footnotes
You can include footnotes using the Insert -> Footnote command (or the ⇧⌘ F7 keyboard shortcut). Footnote editing occurs in a pane immediately below the main document:
By default footnotes will be written in markdown immediately below the block in which they appear. You can customize this behavior via editor options.
Embedded Code
Source code which you include in a Quarto document can either be for display only or can be executed by Jupyter or Knitr as part of rendering. Code can furthermore be either inline or block.
Displaying Code
To display but not execute code, either use the Insert -> Code Block menu item, or start a new line and type either:
``` (for a plain code block); or
```<lang> (where <lang> is a language) for a code block with syntax highlighting.
Then press the Enter key. To display code inline, simply surround text with backticks (`code`), or use the Format -> Code menu item.
Code Chunks
To insert an executable code chunk, use the Insert -> Code Chunk menu item, or start a new line and type:
```{r}
Then press the Enter key. Note that r could be another language supported by knitr (e.g. python or sql) and you can also include a chunk label and other chunk options.
To include inline R code, you just create normal inline code (e.g. by using backticks or the ⌘ D shortcut) but preface it with r. For example, this inline code will be executed by knitr: `r Sys.Date()`. Note that when the code displays in visual mode it won’t have the backticks (but they will still appear in source mode).
Running Chunks
You can execute the currently selected R or Python code chunk using either the run button at the top right of the code chunk or using the ⇧⌘ Enter keyboard shortcut:
You can execute code chunks up to the current one using the toolbar button or using the ⌥⌘ P keyboard shortcut.
LaTeX and HTML
You can also include raw LaTeX commands or HTML tags when authoring in visual mode. The raw markup will be automatically recognized and syntax highlighted. For example:
The above examples utilize inline LaTex and HTML. You can also include blocks of raw content using the commands on the Format -> Raw menu. For example, here is a document with a raw LaTeX block:
Note that Pandoc ignores LaTeX commands when not producing LaTeX based output, and ignores HTML tags when not producing HTML based output.
Citations
Visual mode uses the standard Pandoc markdown representation for citations (e.g. [@citation]). Citations can be inserted from a variety of sources:
Your document bibliography.
Zotero personal or group libraries.
DOI (Document Object Identifier) references.
Searches of Crossref, DataCite, or PubMed.
If you insert citations from Zotero, DOI look-up, or a search then they are automatically added to your document bibliography.
Bibliographies
Pandoc supports bibliographies in a wide variety of formats including BibTeX and CSL. Add a bibliography to your document using the bibliography YAML metadata field. For example:
---
title: "My Document"
bibliography: references.bib
link-citations: true
---
Note that we’ve also specified the link-citations option, which will make your citations hyperlinks to the corresponding bibliography entries.
See the Pandoc Citations documentation for additional information on bibliography formats.
Inserting Citations
You insert citations by either using the Insert -> Citation command or by using markdown syntax directly (e.g. [@cite] or @cite) .
Citations go inside square brackets and are separated by semicolons. Each citation must have a key, composed of ‘@’ + the citation identifier from the database, and may optionally have a prefix, a locator, and a suffix. The citation key must begin with a letter, digit, or _, and may contain alphanumerics, _, and internal punctuation characters (:.#$%&-+?<>~/). Here are some examples:
Blah Blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
Blah Blah [@doe99, pp. 33-35, 38-39 and passim].
Blah Blah [@smith04;
@doe99].
Smith says blah [-@smith04].
You can also write in-text citations, as follows:
@smith04 says blah.
@smith04 [p. 33] says blah.
See the Pandoc Citations documentation for additional information on citation syntax.
Use the toolbar button or the ⇧⌘ F8 keyboard shortcut to show the Insert Citation dialog:
Note that you can insert multiple citations by using the add button on the right side of the item display.
Markdown Syntax
You can also insert citations directly using markdown syntax (e.g. [@cite]). When you do this a completion interface is provided for searching available citations:
Citation IDs
Before inserting a citation from an external source you may wish to customize its ID. Within the Insert Citation dialog, click the edit button on the right side of citations to change their ID:
If you insert a new citation via code completion, you will also be provided with the opportunity to change its default citation ID.
For citations inserted from Zotero, you can also use the Better BibTeX plugin to generate citation IDs (this can be enabled via Citation Options if you have Better BibTeX installed).
Citation Preview
Once you’ve inserted a citation, place the cursor over it to see a preview of it along with a link to the source if one is available:
Citations from DOIs
Use the From DOI pane of the Insert Citation dialog to insert a citation based on a DOI (e.g. that you have retrieved from a PubMed or other search):
If you are using markdown syntax, you can also paste a DOI after the [@ and it will be looked up:
Once you’ve confirmed that it’s the correct work (and possibly modified the suggested ID), the citation will be inserted into the document and an entry for the work added to your bibliography.
Citations from Search
Use the Crossref, DataCite, and PubMed panes of the Insert Citation dialog to search one of those services for a citation:
Items inserted from a search will automatically be added to your bibliography.
Note that for PubMed queries you can use the full supported query syntax. For example, this query searches on the author and title fields: Peterson[Author] AND Embolism[Title]. You can learn more about building PubMed queries here: https://pubmed.ncbi.nlm.nih.gov/advanced/.
Citations from Zotero
Zotero is a popular free and open source reference manager. If you use Zotero, you can also insert citations directly from your Zotero libraries. If you have Zotero installed locally its location will be detected automatically and citations from your main library (My Library) will be available:
Zotero references will also show up automatically in completions:
Items from Zotero will appear alongside items from your bibliography with a small “Z” logo juxtaposed over them. If you insert a citation from Zotero that isn’t already in your bibliography then it will be automatically added to the bibliography.
If you are running both RStudio and Zotero on your desktop, then no additional configuration is required for connecting to your Zotero library. If however you using RStudio Server and/or want to access your Zotero library over the web, then a few more steps are required (see the Zotero Web API section for details).
Group Libraries
Zotero Groups provide a powerful way to share collections with a class or work closely with colleagues on a project. By default, Zotero Group Libraries are not included in the Insert Citation dialog or citation completions. However, there are options available to use group libraries at a global, per-project, or per-document level.
For example, here we specify a project-level option to use the Reproducible Research Series (Year 1) group library:
You can also specify one or more libraries within YAML. For example:
---
title: "Reproducible Research"
zotero: "Reproducible Research Series (Year 1)"
---
Note that you can also turn off Zotero entirely for a document using zotero: false:
---
title: "Reproducible Research"
zotero: false
---
Zotero Web API
If you are using RStudio Server and/or don’t have Zotero installed locally, you can still access your Zotero library using the Zotero Web API (assuming you have a Zotero web account and have synced your libraries to your account).
If you are running RStudio Desktop, it’s generally easier to also run Zotero on your desktop and access your library locally. That said, it is possible to access Zotero web libraries from RStudio Desktop if you prefer that configuration.
API Access Key
RStudio accesses Zotero web libraries using the Zotero Web API, so the first step is to create a Zotero account and then configure Zotero to sync its data to your account. You can do this using the Sync tab of the Zotero preferences:
Once you’ve configured your library to sync, you need to create a Zotero API Key to use with RStudio:
Follow the instructions to create a new access key. Note that if you want to use Group Libraries with RStudio that you should change the default to provide read-only access to groups (as illustrated above).
Be sure to record your key after generating it (i.e. copy it to the clipboard and/or save it somewhere more permanent) as you won’t be able to view it again after you navigate away.
Finally, go to the R Markdown -> Citations preferences to connect Zotero to RStudio using your key:
Set the Zotero Library option to “Web”, then paste in your Zotero Web API Key. You can use Verify Key… button to confirm that your Zotero API key is working correctly.
Once you’ve confirmed your connection you are ready to start inserting citations from Zotero. | {
"lastmod": "2023-07-05T19:35:15.975Z",
"loc": "https://quarto.org/docs/visual-editor/technical.html",
"source": "https://quarto.org/docs/visual-editor/technical.html"
} |
Overview
The Quarto visual editor provides a WYSIWYM editing interface for all of Pandoc markdown, including tables, citations, cross-references, footnotes, divs/spans, definition lists, attributes, raw HTML/TeX, and more. The visual editor also includes support for executing code cells and viewing their output inline:
The visual editor doesn’t attempt to abstract away or obscure the underlying markdown document. Rather, it aims to provide a highly productive writing interface for people that love markdown. You can also still use most markdown constructs (e.g., ## or bold) directly for formatting.
Switching Modes
Markdown documents can be edited in either source or visual mode. To switch into visual mode for a given document, use the Source or Visual button at the top-left of the document toolbar (or alternatively the ⌘⇧ F4 keyboard shortcut):
Note that you can switch between source and visual mode at any time (editing location and undo/redo state will be preserved when you switch).
Getting Started
The Quarto visual editor is currently available as a feature of the RStudio IDE. The visual editor will eventually also be made available in standalone form.
To get started with the visual editor, download the latest release of RStudio (v2023.03) for your platform from:
https://posit.co/download/rstudio-desktop/
Using the Editor
Keyboard Shortcuts
There are keyboard shortcuts for all basic editing tasks. Visual mode supports both traditional keyboard shortcuts (e.g. ⌘ B for bold) as well as markdown shortcuts (using markdown syntax directly). For example, enclose **bold** text in asterisks or type ## and press space to create a second level heading. Here are some of the most commonly used shortcuts:
Command
Keyboard Shortcut
Markdown Shortcut
Bold
⌘ B
**bold**
Italic
⌘ I
*italic*
Code
⌘ D
`code`
Heading 1
⌥⌘ 1
#
Heading 2
⌥⌘ 2
##
Heading 3
⌥⌘ 3
###
Link
⌘ K
<href>
R Code Chunk
⌥⌘ I
```{r}
See the editing shortcuts article for a complete list of all shortcuts.
Insert Anything
You can also use the catch-all ⌘ / shortcut to insert just about anything. Just execute the shortcut then type what you want to insert. For example:
If you are at the beginning of a line (as displayed above), you can also enter plain / to invoke the shortcut.
Editor Toolbar
The editor toolbar includes buttons for the most commonly used formatting commands:
Additional commands are available on the Format, Insert, and Table menus:
Format
Insert
Table
Learning More
Check out the following articles to learn more about visual markdown editing:
Technical Writing covers features commonly used in scientific and technical writing, including citations, cross-references, footnotes, equations, embedded code, and LaTeX.
Content Editing provides more depth on visual editor support for tables, lists, pandoc attributes, CSS styles, comments, symbols/emojis, etc.
Shortcuts & Options documents the two types of shortcuts you can use with the editor: standard keyboard shortcuts and markdown shortcuts and describes various options for configuring the editor.
Markdown Output describes how the visual editor parses and writes markdown and describes various ways you can customize this. | {
"lastmod": "2023-07-05T19:35:15.975Z",
"loc": "https://quarto.org/docs/visual-editor/index.html",
"source": "https://quarto.org/docs/visual-editor/index.html"
} |
Visual mode supports editing all of Pandoc markdown. Standard formatting commands (headings, bold, italic, etc.) work just the way they do in a conventional word processor.
See the Using the Editor section for more details on how to access core editing commands. Note also that you can access all editing commands via keyboard shortcuts.
Editing of links, images, blockquotes, lists, tables, etc. is also available, as is the ability to specify Pandoc attributes and insert special characters and emojis.
Editing Tables
You can insert a table using the Table menu. You can then use either the main menu or a context menu to insert and delete table rows and columns:
Note that if you select multiple rows or columns the insert or delete command will behave accordingly. For example, to insert 2 rows, first select 2 rows then use the insert command.
When you make a selection of multiple rows and/or columns as illustrated above, you can also copy and paste groups of cells within the table.
Editing Lists
As described above, you can create a new list by just typing - or 1. at the beginning of an empty paragraph. To add items to the list, just press Enter within a list item. To exit the list, press Enter within an empty list item.
While this covers many simple list editing tasks, there is a variety of other actions you may want to take within lists, including creating nested lists and adding paragraphs or code blocks to an exiting list item. From an empty list item (pictured at left), the following keyboard gestures can be used to do this:
Empty Item (enter to exit list)
Tab (add sublist)
Backspace (add block)
You can also use Shift+Tab to lift a list item into the previous level.
Tight Lists
Markdown distinguishes between normal and tight lists, where tight lists have less vertical spacing between items. In markdown source code, you designate a tight list by having no empty lines between your list items.
Visual mode creates normal lists by default (you can change this behavior via Editor Options). You can toggle between normal and tight lists using the ⌥⌘ 9 keyboard shortcut. You can also change the list type using the Format -> Edit Attributes dialog (also accessible via the F4 shortcut). If you have existing tight lists in your markdown source files, they will remain so within the visual editor.
Pandoc Attributes
Several of Pandoc’s block types (e.g. headings, code blocks, and divs) enable you to specify a set of custom attributes. Attributes include IDs and class names, as well as arbitrary key-value pairs that are passed through to output formats (e.g. as attributes for HTML tags). For these block types, an edit button will appear at the the top right when your cursor is within the block:
Note that any ID as well as the first class specified within the attributes are also displayed. Click the edit button or use the F4 keyboard shortcut to edit the attributes.
Special Characters
Hard Line Breaks
You can insert a hard line break using the Insert -> Special Characters -> Hard Line Break command or via the ⇧ Enter keyboard shortcut.
Non-Breaking Spaces
You can insert a non-breaking space using the Insert -> Special Characters -> Non-Breaking Space command or via the ⌃ Space keyboard shortcut. Non-breaking spaces are displayed with an alternate background color to distinguish them from normal spaces.
A markdown non-breaking space will result in the character within HTML output and a ~ character within LaTeX output.
Emojis
To insert an emoji, you can use either the Insert menu or the requisite markdown shortcut plus auto-complete:
Insert -> Special Characters -> Emoji…
Markdown Shortcut
For markdown formats that support text representations of emojis (e.g. :grinning:), the text version will be written. For other formats the literal emoji character will be written. Currently, the gfm and hugo (with enableEmoji = true in the site config) formats both support text representation of emojis.
If you want to add support for markdown emoji output to another Quarto format, you can add the emoji extension to the from option in document metadata. For example:
---
title: "My Document"
from: markdown+emoji
---
Unicode Symbols
To insert an arbitrary Unicode character, use Insert -> Special Characters -> Unicode…:
You can search for characters either by name or by entering an explicit Unicode code point (e.g. “U+0420”).
Smart Punctuation
When the Pandoc smart extension is enabled (which it is by default), straight quotes are interpreted as curly quotes, --- as em-dashes, -- as en-dashes, and ... as ellipses. In addition, non-breaking spaces are inserted after certain abbreviations, such as “Mr.”
Visual mode supports these same transformations (so when you type --- it becomes an em-dash). If you didn’t intend for this transformation to occur just hit backspace and it will be reverted.
Spell-Checking
When RStudio real time spell-checking is enabled (you can do this using Spelling preferences), misspelled words will be underlined as you type:
To resolve a spelling error, right-click on the misspelled word, then either choose an alternate spelling, ignore the word (which applies to the current document only), or add the word to your user dictionary (which applies to all documents).
If you ignore a word by mistake, right-click it again to unignore it. If you want to edit your personal dictionary, use the Edit User Dictionary… button located within Spelling preferences.
Commenting
When reviewing a document you often want to provide inline comments with suggested revisions. This is possible in Quarto using HTML comments (which are ignored by all output formats). Visual mode includes a command for inserting HTML comments as well as special highlighting treatment to easily parse out editing comments from surrounding text.
Note that the # prefix used in the comment is what triggers the special background highlighting. If you remove the # it will still be a valid HTML comment, but just won’t be highlighted as shown above.
You can insert an HTML comment using the Comment button on the toolbar or via the ⇧⌘ C keyboard shortcut. Remember, HTML comments won’t show up in rendered output so they are ideal both for review but also for leaving yourself to-do notes within a document.
CSS Styles
One of the benefits of authoring with markdown is that your content can be easily published to a wide variety of formats. This is possible in significant measure because of the limitations that markdown imposes: you author in terms of the structure and semantics of your content, rather than worrying about specifically how things will appear.
Sometimes however you know that you’ll be publishing to HTML, and you want to exert more control over how things look. In this case, you can use CSS (Cascading Style Sheets) along with markdown to do custom formatting. This section covers how to:
Define CSS styles for your document; and
Apply those styles to entities within your document.
If you are new to CSS, you may want to brush up on the basics before proceeding.
CSS styles apply only to HTML output, and will not have any impact on the formatting of other output types like PDF or MS Word.
Defining Styles
The best way to include CSS styles is to create an external stylesheet (e.g. styles.css), then include it within the output options of your document. For example:
---
title: "CSS Demo"
format:
html:
css: styles.css
---
The styles.css file might look something like this:
.important {
color: maroon;
}
.illustration {
border: 1px solid rgb(230, 230, 230);
}
Note that it’s also possible to define styles inline with a CSS code chunk, but we recommend using an external file for easier manageability.
Within a markdown document you can apply one or more CSS classes to various document entities including headings, images, divs, and spans. CSS classes are applied using pandoc attributes. Once you’ve applied a class to an entity, it will derive its formatting from the CSS properties of the specified class.
Headings
To add a CSS class to a heading, use the edit button at the top right of the heading that appears when your cursor is within it (or use the F4 keyboard shortcut):
Note the presence of the .important class within the Edit Attributes dialog.
CSS classes applied to headings affect all content beneath the heading (an HTML <section> tag is wrapped around the content by Pandoc), so heading classes are a great way to provide custom styles for entire sections of your document.
Note that the visual editor doesn’t currently render content using styles applied through CSS classes so you won’t see the custom formatting while editing. You will however see it when rendering and previewing the HTML version of the document.
Images
You can apply CSS classes to images (for example, to give them a special border) using the standard Image dialog. To do this, double-click the image (or use the F4 shortcut with the image selected) and apply the desired classes:
Note again that the visual editor won’t display your image with the applied CSS classes while editing, however when actually rendering the document to HTML you’ll see the styles reflected.
Divs
Divs are special entities that allow you to apply identifiers and/or styles to a region of a document. Divs are block elements (like paragraphs).
You can create divs using the Insert -> Div command, and you can apply attributes (including CSS classes) to divs the same way as you apply attributes to headings (clicking the edit button or using the F4 keyboard shortcut when you are within a div):
Note the presence of the .important class within the Div Attributes dialog.
Spans
Spans are special entities that allow you to apply identifiers and/or styles to a region of text. Spans are inline formatting marks (like bold or italic).
Spans can be created by selecting text and using the Format -> Span command:
Here we’ve applied a span to the text “customize PDF reports” and we’ve used the span to apply the .important CSS class. Note that as with headings and images the formatting is not displayed in the visual editor, but will be visible when the document is rendered. | {
"lastmod": "2023-07-05T19:35:15.859Z",
"loc": "https://quarto.org/docs/visual-editor/content.html",
"source": "https://quarto.org/docs/visual-editor/content.html"
} |
Overview
Quarto can render Jupyter notebooks represented as plain text (.qmd) or as a normal notebook file (.ipynb). One benefit of using .ipynb is that you can use JupyterLab as your editor.
Here is the “Hello, Quarto” example from the homepage inside JupyterLab:
If you look at the source code you’ll note that YAML options were provided both at the top of the document and within the code cell. We’ll describe working with YAML options in more detail below.
Workflow
The ideal workflow for authoring Quarto notebooks in JupyterLab is to run the quarto preview command from within a terminal:
Terminal
quarto preview notebook.ipynb
The notebook will be rendered and a web browser with a “live preview” opened. Position this browser so that you can see it as you edit and save the notebook:
Every time you save within JupyterLab the preview will be automatically updated. You can use quarto preview for both HTML and PDF output.
In the screenshot above you’ll note that we ran quarto preview inside a JupyterLab terminal window—this is generally recommended so that you can see progress and error messages when renders occur.
Preview uses the default format specified within the document—to use an alternate format pass the --to option to quarto preview. For example:
Terminal
quarto preview notebook.ipynb --to pdf
Note that if you are authoring a book or website you can also use quarto preview on the project directory, which will create a live preview for the entire project.
Running JupyterLab
To run JupyterLab, invoke the jupyter module from within the shell where you are using Quarto:
Platform
Command
Mac/Linux
Terminal
python3 -m jupyter lab
Windows
Terminal
py -m jupyter lab
Render without Preview
You can render a notebook (or group of notebooks) without previewing them using the quarto render command:
Terminal
quarto render notebook.ipynb
Use the --to argument to render to a specific format:
Terminal
quarto render notebook.ipynb --to docx
Note that the target file (in this case notebook.ipynb) should always be the very first command line argument.
JupyterLab Extension
The Quarto JuptyerLab extension enables JupyterLab Notebooks which use Quarto markdown to properly display the contents of the markdown cells. For example, when the Quarto JupyterLab extension is installed, your Notebook will show rendered previews of elements like Callouts, Divs, Mermaid charts, as well as other Quarto elements (including the document front matter as a title block).
You can read more about installing the extension in the Quarto JupyterLab Extension documentation.
YAML Front Matter
The first cell of your notebook should be a Raw cell that contains the document title, author, and any other options you need to specify. Note that you can switch the type of a cell to Raw using the notebook toolbar:
In this example we specify that we want code to appear collapsed by default. There are YAML options to control many other aspects of document rendering. See the documentation on Authoring and Output Formats for additional details.
Markdown Cells
Here’s the underlying code for the markdown cell:
Note that a Quarto cross-reference (@fig-polar) is included in the markdown. Any valid Pandoc markdown syntax can be included in markdown cells.
Output Options
Quarto uses leading comments with a special prefix (#|) to denote cell options. Here we specify the label and fig-cap options so that the plot generated from the cell can be cross-referenced.
Note that options must appear at the very beginning of the cell. As with document front-matter, option names/values use YAML syntax.
There are many output options available, including options to optionally hide code, warnings, and/or output. See the documentation on Output Options for additional details.
Cell Execution
Note that when rendering an .ipynb Quarto will not execute the cells within the notebook by default (the presumption being that you already executed them while editing the notebook). If you want to execute the cells you can pass the --execute flag to render:
Terminal
quarto render notebook.ipynb --execute
You can also specify this behavior within the notebook’s YAML front matter:
---
title: "My Notebook"
execute:
enabled: true
---
There are many other execution options available (e.g. to control caching, optimizing kernel start-up time, etc.). Learn more about these options in Execution Options.
Plain Text Editing
It’s also possible to edit Jupyter notebooks in a plain-text markdown format. You might prefer this if there is more narrative than code in your notebook or if you want to use a file format that is more version control friendly.
Here is the plain text markdown version of the notebook used in the previous examples:
---
title: "Matplotlib Demo"
author: "Norah Smith"
date: "5/22/2021"
format:
html:
code-fold: true
jupyter: python3
---
## Polar Axis
For a demonstration of a line plot on a polar axis, see @fig-polar.
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Note that we’ve added the jupyter: python3 option to the YAML front matter to indicate which Jupyter kernel to render with. You would render this document with:
Terminal
quarto render basics-jupyter.qmd
Markdown files with embedded code chunks should use the file extension .qmd.
Tip
If you are doing most of your work in .qmd files you should consider using RStudio, which includes full support for editing .qmd files that use Python and Jupyter (including code completion, cell-at-a-time execution, and side-by-side preview). See the article on using RStudio for additional details.
Converting Notebooks
You can convert between .ipynb and .qmd representations of a notebook using the quarto convert command. For example:
Terminal
quarto convert basics-jupyter.ipynb # converts to qmd
quarto convert basics-jupyter.qmd # converts to ipynb
See quarto convert help for additional details on converting notebooks.
Jupytext
You can use Jupytext to maintain parallel synchronized versions of .qmd and .ipynb files. Learn more about Jupytext at https://jupytext.readthedocs.io/en/latest/. | {
"lastmod": "2023-07-05T19:35:15.859Z",
"loc": "https://quarto.org/docs/tools/jupyter-lab.html",
"source": "https://quarto.org/docs/tools/jupyter-lab.html"
} |
Overview
The Quarto Neovim plugin aims to not reinvent the wheel. Existing plugins in the Neovim ecosystem are leveraged to provide the full experience. Some of the features provided by quarto-nvim and enhanced by plugins found in the kickstarter configuration are:
Preview for Quarto documents.
Syntax highlighting for markdown and embedded languages
Completion for embedded languages (e.g. Python, R, Julia, etc.)
Commands and key-bindings for running cells and selected lines.
Completion for bibliography references, file paths, LaTeX math symbols, emoji.
Optional spellchecking and completion.
Code snippets.
Export of code chunks into standalone scripts.
More screenshots
Installation
Installation instructions for the quarto plugin and the kickstarter configuration can be found in the respective readme files of the repository:
quarto-nvim
quarto-nvim-kickstarter
Render and Preview
To render and preview, execute the QuartoPreview command by pressing : to enter command mode and typing the command (there is autocompletion if you press the tab key). In the kickstarter configuration, there are more shortcuts starting with space q (spacebar followed by q, in normal mode).
After running the QuartoPreview command in Neovim, the preview will automatically update each time the buffer is saved.
Running Code Cells
You don’t need to fully render documents in order to iterate on code cells. With the provided configuration we can open a terminal of our choosing using the leader key (<space>) followed byc (for code) and then p (for python) or i (for ipython).
If you wait a little in between the key presses a small window pops up at the bottom of your screen to tell you about existing keybindings:
We can navigate between the code and the terminal using ctrl plus vim direction keys and enter commands into the python REPL by going into insert mode in this terminal buffer.
To send code to the python REPL from quarto we navigate to one of our code blocks and press <space><cr> (space bar followed by Enter). The plugin responsible for sending code to various places, vim-slime will prompt us with the question which terminal to send the code to, pre filled with the latest terminal we created.
If you want to use ctrl+Enter to send code just like in RStudio, you are going to have to tell your terminal emulator to send the correct key codes. For example, in the kitty terminal the configuration looks as follows:
map ctrl+shift+enter no_op
map shift+enter send_text all \x1b[13;2u
map ctrl+enter send_text all \x1b[13;5u
This is what the kickstarter configuration has been tested with.
Here are all of the commands and keyboard shortcuts available for executing cells:
Quarto Command
Keyboard Shortcut
Create new terminal
space c x where x is the starting letter of python, r, ipython, julia or bash
Choose terminal
space c c
Show terminal id
space c s
Run Current Cell
space Enter
Run Current Cell
ctrl Enter (insert or normal mode)1
Run Selected Line(s)
Enter (visual mode)
Note that you can quickly insert a new code cell using the Alt+I and Alt+Shift+I keyboard shortcuts, the first being an R and the second being a python code chunk. Feel free to change this from the kickstarter configuration depending on your most-used language.
Contextual Assistance
In a code chunk you get autocompletion for the respective language. Use Tab and Shift+Tab to iterate through the suggestions2.
Note
The otter in the completion list means that the completion plugin cmp got it’s completion suggestions from the otter.nvim plugin, which keeps track of the code in your Quarto document behind the scenes by writing only the code parts to another (an otter) document.
Code Snippets
Code snippets are templates that make it easier to enter repeating code patterns (e.g. code blocks, callouts, divs, etc.). You will find them in the autocompletion list and can trigger them with enter. Sometimes they contain multiple places within the snippet where the cursor can jump to. Use ctrl+n to jump to the next site.
For example, we might want to create a two column layout, so we type col2 and accept the suggestion with Enter to get
::: {layout-ncol=2}
:::
If you find other helpful snippets, feel free to add a pull request to extend the ones included in the kickstarter configuration snippet list.
Document Navigation
Vim is famously good at letting you navigate documents quickly. Here, we only have a look at some additional features provided by quarto-nvim. For the full range of options, refer to the documentation of vim/neovim and of the plugins included in the kickstarter configuration.
Press space l o to toggle a section overview
Navigate to the next code chunk with [c or the previous one with ]c
Delete/Change/Yank the code of a chunk with dio/cio/yio
Delete/Change/Yank a whole code chunk with it’s delimiters with dao/cao/yao
Take a look at the files of the kickstarter configuration for more inspiration.
Extending Quarto: Lua Development in Neovim
Since Lua is already the language used to configure Neovim and the kickstarter configuration installs the Lua Language Server, code completion and diagnostics will be enabled for Quarto extension development.
Footnotes
if your terminal emulator supports this, see Running Cells↩︎
or set your own keybindings for it here↩︎ | {
"lastmod": "2023-07-05T19:35:15.859Z",
"loc": "https://quarto.org/docs/tools/neovim.html",
"source": "https://quarto.org/docs/tools/neovim.html"
} |
In addition to editing Quarto documents as plain-text .qmd files, you can also use the VS Code Notebook Editor to author .ipynb notebooks that are rendered with Quarto. In this article we’ll review the basics of editing .ipynb notebooks for use with Quarto.
Render and Preview
The basic workflow for editing notebooks for use with Quarto is identical to the workfow for .qmd files. Edit the file and then execute the Quarto: Render command (you can alternatively use the Ctrl+Shift+K keyboard shortcut). You’ll see a preview of the published page side by side with the notebook:
After you’ve done an initial Quarto: Render, the preview will automatically update every time you save the notebook.
YAML Front Matter
The first cell of your notebook should be a Raw cell that contains the document title, author, and any other options you need to specify. Note that you can switch the type of a cell to Raw using the cell type menu at the bottom right of the cell:
In this example we specify that we want code to appear collapsed by default. There are YAML options to control many other aspects of document rendering. See the documentation on Authoring and Output Formats for additional details.
Markdown Cells
Here’s the underlying code for the markdown cell:
Note that a Quarto cross-reference (@fig-polar) is included in the markdown. Any valid Pandoc markdown syntax can be included in markdown cells.
Output Options
Quarto uses leading comments with a special prefix (#|) to denote cell options. Here we specify the label and fig-cap options so that the plot generated from the cell can be cross-referenced.
Note that options must appear at the very beginning of the cell. As with document front-matter, option names/values use YAML syntax.
There are many output options available, including options to optionally hide code, warnings, and/or output. See the documentation on Output Outputs for additional details.
Cell Execution
Note that when rendering an .ipynb Quarto will not execute the cells within the notebook by default (the presumption being that you already executed them while editing the notebook). If you want to execute the cells you can pass the --execute flag to render:
Terminal
quarto render notebook.ipynb --execute
You can also specify this behavior within the notebook’s YAML front matter:
---
title: "My Notebook"
execute:
enabled: true
---
There are many other execution options available (e.g. to control caching, optimizing kernel start-up time, etc.). Learn more about these options in Execution Options.
Converting Notebooks
You can convert between .ipynb and .qmd representations of a notebook using the quarto convert command. For example:
Terminal
quarto convert basics-jupyter.ipynb
quarto convert basics-jupyter.qmd
See quarto convert help for additional details on converting notebooks. | {
"lastmod": "2023-07-05T19:35:15.859Z",
"loc": "https://quarto.org/docs/tools/vscode-notebook.html",
"source": "https://quarto.org/docs/tools/vscode-notebook.html"
} |
Overview
If you are editing plain markdown documents (with no embedded computations) you may want to use your favorite text editor (Vim, Emacs, Sublime, etc.) to author Quarto documents. This articles provides some guidance on the optimal workflow when using text editors with Quarto.
Note that if you are using either the Jupyter or Knitr computational engine you will likely be better off using JupyterLab or VS Code (for .ipynb notebooks) or RStudio (for .qmd documents) as these environments provide code-completion, incremental cell execution, and other useful tools for working with executable code.
Workflow
The ideal workflow for authoring Quarto markdown documents is to run the quarto preview command from within a terminal:
Terminal
quarto preview document.qmd
The document will be rendered and a web browser with a “live preview” opened. Position this browser so that you can see it as you edit and save the document:
Every time you save the preview will be automatically updated. You can use quarto preview for both HTML and PDF output.
Preview uses the default format specified within the document—to use an alternate format pass the --to option to quarto preview. For example:
Terminal
quarto preview notebook.qmd --to pdf
Note that if you are authoring a book or website you can also use quarto preview on the project directory, which will create a live preview for the entire project.
Render without Preview
You can render a document (or group of documents) without previewing them using the quarto render command:
Terminal
quarto render document.qmd
Use the --to argument to render to a specific format:
Terminal
quarto render document.qmd --to docx
File Extension
Most text editors have a syntax highlighting mode that applies to markdown files (typically with the .md extension). You will likely want to configure your editor to also recognize the .qmd extension as having markdown content. | {
"lastmod": "2023-07-05T19:35:15.859Z",
"loc": "https://quarto.org/docs/tools/text-editors.html",
"source": "https://quarto.org/docs/tools/text-editors.html"
} |
Overview
Quarto supports the creation of custom formats that extend base formats like pdf, html, and docx. The custom format system is very flexible, and has been designed to accommodate the creation of articles for publishing in professional Journals.
A major focus is single-source publishing: the same Quarto document source should be capable of producing both HTML and LaTeX output, and should also be capable of creating the LaTeX required for submission to multiple Journals. Key capabilities that enable this include:
The ability to flexibly adapt the native LaTeX templates provided by Journals for use with Pandoc.
The use of spans and divs to apply formatting (which enables targeting by CSS for HTML output and LaTeX macros/environments for PDF output).
A standardized schema for authors and affiliations so that you can express this data once and then have it automatically formatted according to the styles required for various Journals.
The use of Citation Style Language (CSL) to automate the formatting of citations and bibliographies according to whatever style is required by various Journals.
Journal Formats
The Quarto team has developed several Journal formats and made them available within the quarto-journals GitHub organization. These formats include:
ACM (preview)
PLOS (preview)
ASA (preview)
Elsevier (preview)
Biophysical (preview)
ACS (preview)
JSS (preview)
Many more formats will be added over time and we welcome proposals from the community for contributed formats (please post an issue at https://github.com/quarto-journals/article-format-template/issues if you are interested in contributing a format).
The quarto use template command can be used to create an article from one these formats. For example:
Terminal
quarto use template quarto-journals/acm
quarto use template quarto-journals/plos
quarto use template quarto-journals/elsevier
quarto use template quarto-journals/acs
quarto use template quarto-journals/jss
Note that the above commands will create a brand new article with default contents. In some cases you may want to use a Journal format in an existing document or project without copying the entire template. In that case you can just add the format extension by itself. For example:
Terminal
quarto add quarto-journals/acm
quarto add quarto-journals/plos
Follow the links for any of the formats above to learn more about how to use them with your own articles.
Creating Formats
While the list of supported journals on quarto-journals will grow over time, it’s likely that many users will want to create their own Journal formats. Creating a new format typically involves:
Adapting the LaTeX template typically provided by Journals for use with Quarto.
Selecting the appropriate citation processing and style for use with the format.
Creating a template.qmd that demonstrates using the format.
Optionally, ensuring that both HTML and LaTeX articles are well supported.
See the article on Journal Formats for additional details on creating your own formats. | {
"lastmod": "2023-07-05T19:35:15.675Z",
"loc": "https://quarto.org/docs/journals/index.html",
"source": "https://quarto.org/docs/journals/index.html"
} |
Overview
An important goal for Quarto is to make it possible to use the same source document to produce multiple output formats. One significant challenge to overcome is defining a consistent way to express author and affiliation metadata such that articles targeting multiple Journals do not require special tweaking of authors and affiliations for each publication.
Quarto’s answer to this challenge is two-fold:
Parse a variety of expressions of authors and affiliations into a standard schema.
Provide de-normalized views of authors together with affiliations such that it is straightforward for template authors to create the LaTeX required by Journals.
Below we’ll explore these facilities in more detail from the standpoint of template authors. To learn more about these facilities from the perspective of article writers, see Authors & Affiliations.
Note
Note that while there is a great deal of variety afforded in how authors and affiliations are specified, for a given Journal template.qmd you will likely have a preferred approach, and it’s good form to seed the template with an example of this approach.
Author Metadata
Quarto will look in the author or authors field for data that can be parsed into a normalized representation of authors. This can be as simple as a name of list of names:
author:
- Norah Jones
- Bill Gates
Or alternatively can be a complex data structure expressing a variety of properties and attributes of authors along with their affiliations:
author:
- name: Bill Gates
orcid: 0000-0003-1689-0557
email: [email protected]
affiliations:
- name: Bill & Melinda Gates Foundation
address: 440 5th Ave N
city: Seattle
state: WA
postal-code: 98109-4631
For both of the above expressions, Quarto processes and normalizes the author and affiliation data into the keys described below.
author
The author metadata key receives a simple list of names that will render properly in most existing Pandoc templates not aware of the Quarto extended schema.
authors
The authors metadata key contains the normalized author data structure. Affiliations are referenced (rather than placed inline), so this typically shouldn’t be used by templates to output author data. The order the authors appear in the metadata will be preserved.
affiliations
The affiliations metadata key contains the normalized affiliation data structure. Ids are automatically assigned if not defined. Affiliations contain no reference to their authors, so are typically not used by templates to output affiliation data. The order the affiliations appear in the metadata will be preserved. Duplicate affiliations are removed.
by-author
The by-author metadata key contains a denormalized version of the author data organized in the original order of the authors. Rather than referencing affiliations, each author will have the full parsed contents of affiliations available in the affiliations subkey, making it easy for template authors to iterate through authors and then, within that, their affiliations. The order the authors appear in the metadata will be preserved.
by-affiliation
The by-affiliation metadata key contains a denormalized version of affiliation data in the original order the affiliations appeared. Author data appears in order in the authors subkey, which contains the full parsed author data. This makes it easy for template authors to iterate over affiliations and the authors for each affiliation. The order the affiliations appear in the metadata will be preserved.
Author Schema
The complete, normalized, author schema is as follows:
author:
- id: string
number: number
name:
given: string
family: string
literal: string
dropping-particle: string
non-dropping-particle: string
url: string
email: string
fax: string
orcid: string
note: string
acknowledgements: string
attributes:
corresponding: boolean
equal-contributor: boolean
deceased: boolean
metadata: object
affiliations:
# see schema below
Names
Most often, users will write a single string for name, like:
author: Norah Jones
or perhaps like:
author:
- name: Norah Jones
Which will be parsed into:
author:
- name:
given: Norah
family: Jones
literal: Norah Jones
Quarto will parse names using BibTeX (a la openjournals/inara), supporting BibTeX’s parsing behavior for comma count, capitalization, and so on. When the name is unparseable by BibTeX, Quarto will attempt to parse names into given and family using spaces (everything after the last space is considered a family name), but to disambiguate, you may provide separate keys for the given name, family name and particle:
name:
given: Norah
family: Jones
dropping-particle: von
Attributes
Recognized attribute keys that appear at the top level (for example, corresponding) will automatically be normalized under attributes. For example:
author:
name: Norah Jones
corresponding: true
would be normalized into:
author:
- name:
given: Norah
family: Jones
literal: Norah Jones
attributes:
corresponding: true
Arbitrary Metadata
The normalized authors schema at the top level is a closed schema. Unrecognized keys that are passed in the root of authors will be normalized under the metadata key. For example:
author:
name: Norah Jones
corresponding: true
custom-info: "custom value"
would be normalized into:
author:
- name:
given: Norah
family: Jones
literal: Norah Jones
attributes:
corresponding: true
metadata:
custom-info: "custom value"
Keys that are normalized into metadata should be considered potentially template specific and may not be present or depended upon when implementing a template.
Affiliations Schema
The complete, normalized affiliations schema is defined as:
affiliations:
- id: string
number: number
name: string
department: string
address: string
city: string
region: string
country: string
postal-code: string
url: string
Parsing Notes
You may specify either state or region- either will be normalized into the region key.
If you specify only a string for an affiliation, it will be used as the name of affiliation.
You may omit an id and the id will be automatically generated (a simple counter based id will be used).
The url field may also be populated by an affiliation-url key in the author, which preserves compatibility with Distill metadata for authors and affiliations.
Combinations
To combine the above schemas, users may specify author and affiliations in a number of different ways. Each will be normalized into the standard schema described above.
Inline Affiliations
You may write affiliations as simple string or complex affiliations inline. For example:
author:
- name: Norah Jones
affiliations:
- Carnegie Mellon University
- University of Chicago
or
author:
- name: Norah Jones
affiliations:
- name: Carnegie Mellon University
city: Pittsburgh
state: PA
- name: University of Chicago
city: Chicago
state: IL
Reference Affiliations
You may write out the affiliations into a separate key and only reference the affiliation in the author. For example:
author:
- name: Norah Jones
affiliations:
- ref: cmu
- ref: chicago
affiliations:
- id: cmu
name: Carnegie Mellon University
city: Pittsburgh
state: PA
- id: chicago
name: University of Chicago
city: Chicago
state: IL
Inline References
You may also assign ids to affiliations created in the author key and use those ids as references in other authors. For example:
author:
- name: Norah Jones
affiliations:
- id: cmu
name: Carnegie Mellon University
city: Pittsburgh
state: PA
- id: chicago
name: University of Chicago
city: Chicago
state: IL
- name: John Hamm
affiliations:
- ref: cmu
- name: University of California, San Diego
city: San Diego
state: CA | {
"lastmod": "2023-07-05T19:35:15.675Z",
"loc": "https://quarto.org/docs/journals/authors.html",
"source": "https://quarto.org/docs/journals/authors.html"
} |
Overview
Netlify is a professional web publishing platform with support for many advanced features including custom domains, authentication, branch previews, and instant rollbacks. Netlify also has a free plan that is ideal for personal projects, hobby sites, or experiments.
There are several ways to publish Quarto content to Netlify:
Use the quarto publish command to publish content rendered on your local machine.
If you are using GitHub, GitLab, Bitbucket, or Azure DevOps, you can point Netlify at your site’s source code and have it deployed whenever your code changes.
If you are using GitHub, you can use a GitHub Action to automatically render your project and publish the resulting content whenever your code changes.
If you are using another Continuous Integration (CI) service, you can script the quarto publish command to render and publish content to Netlify.
We’ll cover each of these methods below, starting with the most straightforward and then proceeding to more sophisticated scenarios.
Publish Command
The quarto publish command is the easiest way to publish locally rendered content. From the directory where your project is located, execute the quarto publish command for Netlify:
Terminal
quarto publish netlify
If you haven’t published to Netlify before, the publish command will prompt you to authenticate. After confirming that you want to publish, your content will be rendered and deployed, and then a browser opened to view your site.
_publish.yml
The _publish.yml file is used to to specify the publishing destination. This file is automatically created (or updated) whenever you execute the quarto publish command, and is located within the project or document directory.
The service, id, and URL of the published content is specified in _publish.yml. For example:
- source: project
netlify:
- id: "5f3abafe-68f9-4c1d-835b-9d668b892001"
url: "https://tubular-unicorn-97bb3c.netlify.app"
If you have an existing Netlify site that you want to publish to, you should manually create a _publish.yml file that looks like the example above, but with the appropriate id and url values for your site.
Account information is not stored in _publish.yml, so it is suitable for checking in to version control and being shared by multiple publishers.
Options
You can customize the behavior of quarto publish by providing the following command line options:
Option
Behavior
--no-prompt
Do not prompt to confirm publish actions.
--no-browser
Do not open a browser after publish.
--no-render
Do not re-render prior to publish
To publish a document rather than a website or book, provide the path to the document:
Terminal
quarto publish netlify document.qmd
Domain Name
The domain name for your published site will by default use a random identifier (e.g. mystifying-jepsen-fa4396.netlify.app). You can pick a more descriptive sub-domain (still using netlify.app as the main domain) or if you own another domain, assign that one to the site. These options are available (respectively) from the Site settings and Domain settings panels:
Within Site settings, click the Change site name button to specify a different sub-domain:
If you own another domain that you want to use for your site, follow the directions in Domain settings.
Publish from Git Provider
Netlify has the ability to automatically deploy sites when changes are committed to Git repositories hosted on GitHub, GitLab, Bitbucket, and Azure DevOps. The most straightforward approach to this is to check your rendered site (i.e. the _site or _book directory) into version control and have Netlify deploy that. We’ll cover that scenario first and then explore using a Netlify Build Plugin to render the site on Netlify servers.
Importing a Project
Start by going to the main Netlify page for your team, choosing Add new site, and then Import an existing project:
You’ll be prompted to authenticate with your version control provider, select a repository, and then finally specify the configuration for publishing the site.
Publishing Configuration
The build settings for our project will have no Build command and will specify _site or _book (as appropriate) for the Publish directory:
If you have your _site or _book directory checked into version control then everything is now configured and your site will be deployed to Netlify automatically whenever you commit to your repository.
Rendering on Netlify
If you prefer not to check your rendered site into version control, you can also use the Quarto Netlify Build Plugin to render on a Netlify build server (note that Netlify servers can only render markdown and cannot execute R, Python, or Julia code).
Freezing Computations
To make sure that R, Python, and Julia code is only executed locally, configure your project to use Quarto’s freeze feature by adding this to your _quarto.yml:
_quarto.yml
execute:
freeze: auto
Now, fully re-render your site:
Terminal
quarto render
If you have executable code in your project you’ll notice that a _freeze directory has been created at the top level of your project. This directory stores the results of computations and should be checked in to version control. Whenever you change a .qmd file with executable code, it will automatically be re-run during your next render and the updated computations will be stored in _freeze.
Ignoring Output
It’s important to note that you don’t need to check your _site or _book directory into version control (if you have done this in the past you know it makes for very messy diffs!). Before proceeding you should add the output directory of your project to .gitignore. For example:
.gitignore
/.quarto/
/_site/
If you’ve already checked these files into source control you may need to remove them explicitly:
Terminal
git rm -r _site
Plugin Configuration
To use the Quarto Netlify Build Plugin, add the following two files to your project:
netlify.toml
[[plugins]]
package = "@quarto/netlify-plugin-quarto"
package.json
{
"dependencies": {
"@quarto/netlify-plugin-quarto": "^0.0.5"
}
}
Now, commit and push your modified project (including _freeze, netlify.toml, and package.json). Assuming that you configured the project correctly in the previous step (i.e. Publish directory set to the _site or _book directory) then Netlify will begin rendering and publishing your site each time you push a new commit.
GitHub Action
Using the quarto publish netlify command to publish locally rendered content is the most simple and straightforward way to publish. Another option is to use GitHub Actions to render and publish your site (you might prefer this if you want execution and/or rendering to be automatically triggered from commits).
There are a few different ways to approach rendering and publishing content. Below, we’ll provide a how-to guide for publishing with GitHub Actions. For more conceptual background on the various approaches, see the discussion on Rendering for CI.
Publish Record
Prior to attempting to publish with a GitHub Action, you should have completed at least one publish using the Publish Command (described immediately above). This publish will create a _publish.yml file that records the publishing destination to be used by the GitHub Action. For example:
- source: project
netlify:
- id: "5f3abafe-68f9-4c1d-835b-9d668b892001"
url: "https://tubular-unicorn-97bb3c.netlify.app"
You can also manually create a _publish.yml file that looks like the example above, but with the appropriate id and url values for your site.
Do not proceed to the next step(s) until you have a _publish.yml that indicates your publishing destination.
Freezing Computations
To make sure that R, Python, and Julia code is only executed locally, configure your project to use Quarto’s freeze feature by adding this to your _quarto.yml:
_quarto.yml
execute:
freeze: auto
Now, fully re-render your site:
Terminal
quarto render
If you have executable code in your project you’ll notice that a _freeze directory has been created at the top level of your project. This directory stores the results of computations and should be checked in to version control. Whenever you change a .qmd file with executable code, it will automatically be re-run during your next render and the updated computations will be stored in _freeze.
Note that an alternative approach is to execute the code as part of the GitHub Action. For now we’ll keep things simpler by executing code locally and storing the computations by using freeze. Then, further below, we’ll cover [Executing Code] within a GitHub Action.
Publish Action
Add a publish.yml GitHub Action to your project by creating this YAML file and saving it to .github/workflows/publish.yml:
.github/workflows/publish.yml
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Netlify Credentials
The final step is to configure your GitHub Action with the credentials required for publishing to Netlify. To to this you need to create a Netlify personal access token and then configure your GitHub action to be able to read it:
If you don’t already have an access token, go to the Netlify applications page, and click on New Access Token to create a new personal access token. Give this token a memorable name, and copy the token to the clipboard.
Add the Netlify personal access token to your repository’s action Secrets (accessible within repository Settings). You will see a New repository secret button at the top right:
Click the button and add the personal access token from step 1 as a secret named NETLIFY_AUTH_TOKEN:
Ignoring Output
It’s important to note that you don’t need to check your _site or _book directory into version control (if you have done this in the past you know it makes for very messy diffs!). Before proceeding you should add the output directory of your project to .gitignore. For example:
.gitignore
/.quarto/
/_site/
If you’ve already checked these files into source control you may need to remove them explicitly:
Terminal
git rm -r _site
Commit to Publish
Once you’ve specified your publishing action and Netlify credentials, and pushed your updated repository (including the _freeze directory) to GitHub, your action will run with this and subsequent commits, automatically rendering and publishing to Netlify.
Executing Code
If you prefer, you can also configure a GitHub Action to execute R, Python, or Julia code as part of rendering. While this might reflexively seem like the best approach, consider the following requirements imposed when you execute code within a CI service like GitHub Actions:
You need to reconstitute all of the dependencies (R, Python, or Julia plus the correct versions of required packages) in the CI environment.
If your code requires any special permissions (e.g. database or network access) those permissions also need to be present on the CI server.
Your project may contain documents that can no longer be easily executed (e.g. blog posts from several years ago that use older versions of packages). These documents may need to have freeze individually enabled for them to prevent execution on CI.
Prerequisites
The best way to ensure that your code can be executed within a GitHub Action is to use a virtual environment like venv or renv with your project (below we’ll provide example actions for each). If you aren’t familiar with using these tools check out the article on using Virtual Environments with Quarto to learn more.
Once you’ve decided to execute code within your GitHub Action you can remove the freeze: auto described above from your _quarto.yml configuration. Note that if you want to use freeze selectively for some documents or directories that is still possible (for a directory, create a _metadata.yml file in the directory and specify your freeze configuration there—this is what Quarto does by default for the posts folder of blog projects).
Example: Jupyter with venv
Here is a complete example of a GitHub Action that installs Python, Jupyter, and package dependencies from requirements.txt, then executes code and renders output to Netlify:
.github/workflows/publish.yml
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install Python and Dependencies
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- run: pip install jupyter
- run: pip install -r requirements.txt
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Example: Knitr with renv
Here is a complete example of a GitHub Action that installs R and package dependencies from renv.lock, then executes code and renders output to Netlify:
.github/workflows/publish.yml
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.2.0'
- name: Install R Dependencies
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Additional Options
It’s possible to have a Quarto project in a larger GitHub repository, where the Quarto project does not reside at the top-level directory. In this case, add a path input to the invocation of the publish action. For example:
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
path: subdirectory-to-use
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
By default, quarto publish will re-render your project before publishing it. However, if you store the rendered output in version control, you don’t need the GitHub action to re-render the project. In that case, add the option render: false to the publish action:
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
render: false
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Continuous Integration
You can publish Quarto content to Netlify using any CI service by scripting the quarto publish command.
For example, here is a shell script that publishes to Netlify based on the information in a _publish.yml file in the root of the project:
Terminal
# credentials from https://app.netlify.com/user/applications
export NETLIFY_AUTH_TOKEN="45fd6ae56c"
# publish to the netlify site id provided within _publish.yml
quarto publish netlify
Here are the contents of _publish.yml:
- source: project
netlify:
- id: "5f3abafe-68f9-4c1d-835b-9d668b892001"
url: "https://tubular-unicorn-97bb3c.netlify.app"
Here is another variation that provides the publish target on the command line:
Terminal
quarto publish netlify --id 5f3abafe-68f9-4c1d-835b-9d668b892001
See the article on Publishing with CI for additional details on the various approaches to rendering and publishing with Continuous Integration. | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/publishing/netlify.html",
"source": "https://quarto.org/docs/publishing/netlify.html"
} |
Overview
Continuous Integration (CI) refers to the practice of automatically publishing content from code checked in to a version control system. While publishing using CI is a bit more involved to configure, it has several benefits, including:
Content is automatically published whenever source code changes (you don’t need to remember to explicitly render).
Rendering on another system ensures that your code is reproducible (but note that this can be double-edged sword if rendering has special requirements—see the discussion below on Rendering for CI).
Not checking rendered output into version control makes diffs smaller and reduces merge conflicts.
This article covers how to implement CI for Quarto using GitHub Actions (a service run by GitHub), ordinary shell commands (which can be made to work with any CI service), and with Posit Connect.
Rendering for CI
Before you start using a CI server you’ll need to think about where you want executable code (e.g. R, Python, or Julia code) to run and where you want quarto render to run. You might reflexively assume that you’ll always want to run everything on the CI server, however doing so introduces a number of complexities:
You need to make sure that the appropriate version of Quarto is available in the CI environment.
You need to reconstitute all of the dependencies (required R, Python, or Julia packages) in the CI environment.
If your code needed any special permissions (e.g. database or network access) those permissions need also be present on the CI server.
Your project may contain documents that can no longer be easily executed (e.g. blog posts from several years ago that use older versions of packages).
In light of the above, you can think about rendering as a continuum that extends from running everything (including quarto render) locally all the way up to running everything remotely on CI:
Local Execution and Rendering — Run everything in your local environment and then check output (e.g. the _site directory) into version control. In this scenario the CI server is merely making sure that the checked in content is copied/deployed to the right place every time you commit. You might choose this approach to place minimal requirements on software that needs to be present on the CI server.
Local Execution with CI Rendering — Execute R, Python, or Julia code locally and use Quarto’s ability to freeze computational output to save the results of computations into the _freeze directory. Render the site on the CI server (which will use the computations stored in _freeze). Use this approach when its difficult to arrange fully re-executing code on the CI server.
CI Execution and Rendering — Execute all code and perform rendering on the CI server. While this is the gold standard of automation and reproducibility, it will require you to capture your R, Python, or Julia dependencies (e.g. in an renv.lock file or requirements.txt file) and arrange for them to be installed on the CI server. You will also need to make sure that permissions (e.g. database access) required by your code are available on the CI server.
Below we’ll describe how to implement each of these strategies using GitHub Actions, ordinary Shell Commands (which you should be able to adapt to any CI environment), or Posit Connect.
GitHub Actions
GitHub Actions is a Continuous Integration service from GitHub, and an excellent choice if your source code is already managed it a GitHub repository. Quarto makes available a set of standard GitHub Actions that make it easy to install Quarto and then render and publish content.
Learn about using GitHub Actions with various publishing services here:
Quarto Pub
GitHub Pages
Netlify
If you want to use the standard Quarto actions as part of another workflow see the GitHub Actions for Quarto repository.
Posit Connect
If you are publishing a source code version of your content to Posit Connect it’s possible to configure Connect to retrieve the code from a Git repository and then render and execute on the Connect Server.
To learn more about this, see the documentation on Git Backed Content for Posit Connect.
Shell Commands
This section covers using the quarto publish command on a server where no user interaction is possible. This involves the following steps:
Rendering your content.
Specifying where to publish (which service/server, publishing target id, etc.).
Providing the appropriate publishing credentials.
For example, here is a shell script that publishes to Netlify based on the information in a _publish.yml file in the root of the project:
Terminal
# credentials from https://app.netlify.com/user/applications
export NETLIFY_AUTH_TOKEN="45fd6ae56c"
# publish to the netlify site id provided within _publish.yml
quarto publish netlify
Here are the contents of _publish.yml:
- source: project
netlify:
- id: "5f3abafe-68f9-4c1d-835b-9d668b892001"
url: "https://tubular-unicorn-97bb3c.netlify.app"
Here is another variation that provides the publish target on the command line:
Terminal
quarto publish netlify --id 5f3abafe-68f9-4c1d-835b-9d668b892001
Below we’ll cover the various components of a publishing script as well as provide a few additional complete examples.
Rendering for Publish
By default when you execute the publish command, your site or document will be automatically re-rendered:
Terminal
quarto publish
This is generally recommended, as it ensures that you are publishing based on the very latest version of your source code.
If you’d like to render separately (or not render at all) you can specify the --no-render option:
Terminal
quarto publish --no-render
By default, the call to quarto publish will execute all R, Python, or Julia code contained in your project. This means that you need to ensure that the requisite version of these tools (and any required packages) are installed on the CI server. How to do this is outside the scope of this article—to learn more about saving and restoring dependencies, see the article on Virtual Environments.
If you want to execute code locally then only do markdown rendering on CI, you can use Quarto’s freeze feature. For example, if you add this to your _quarto.yml file:
execute:
freeze: true
Then when you render locally computations will run and their results saved in a _freeze folder at the root of your project. Then, when you run quarto publish or quarto render on the CI server these computations do not need to be re-run (only markdown rendering will occur on the server).
Publishing Destination
There are two ways to specify publishing destinations for the quarto publish command:
Via the contents of a _publish.yml file created from a previous publish.
Using command line parameters (e.g. --id and --server).
When you execute the quarto publish command, a record of your publishing destination is written to a _publish.yml file alongside your source code. For example:
- source: project
netlify:
- id: "5f3abafe-68f9-4c1d-835b-9d668b892001"
url: "https://tubular-unicorn-97bb3c.netlify.app"
You can check the _publish.yml file into source control so it is available when you publish from the CI server. If you execute the quarto publish command with no arguments and the above _publish.yml is in the project directory, then the publish will target Netlify with the indicated id:
Terminal
quarto publish netlify
You can also specify a publishing destination via explicit command line arguments. For example:
Terminal
quarto publish netlify --id 5f3abafe-68f9-4c1d-835b-9d668b892001
If you have multiple publishing targets saved within _publish.yml then the --id option can be used to select from among them.
Publishing Credentials
You can specify publishing credentials either using environment variables or via command line parameters. The following environment variables are recognized for various services:
Service
Variables
Quarto Pub
QUARTO_PUB_AUTH_TOKEN
Netlify
NETLIFY_AUTH_TOKEN
Posit Connect
CONNECT_SERVER and CONNECT_API_KEY
Set these environment variables within your script before calling quarto publish. For example:
Terminal
export NETLIFY_AUTH_TOKEN="45fd6ae56c"
quarto publish netlify
Note that you can also specify the publishing target --id as a command line argument. For example:
Terminal
export CONNECT_SERVER=https://connect.example.com/
export CONNECT_API_KEY=7C0947A852D8
quarto publish connect --id DDA36416-F950-4647-815C-01A24233E294
Complete Examples
Here are a few complete examples that demonstrate various ways to write publishing shell scripts:
Terminal
# publish (w/o rendering) to quarto pub based on _publish.yml
export QUARTO_PUB_AUTH_TOKEN="45fd6ae56c"
quarto publish quarto-pub --no-render
Terminal
# render and publish to netlify based on _publish.yml
export NETLIFY_AUTH_TOKEN="45fd6ae56c"
quarto publish netlify
Terminal
# publish (w/o rendering) to netlify with explicit id
export NETLIFY_AUTH_TOKEN="45fd6ae56c"
quarto publish netlify --id DDA36416-F950-4647-815C-01A24233E294 --no-render
Terminal
# publish (w/o rendering) to connect based on _publish.yml
export CONNECT_SERVER=https://connect.example.com/
export CONNECT_API_KEY=7C0947A852D8
quarto publish connect --no-render
Terminal
# render and publish to connect with explicit id
export CONNECT_SERVER=https://connect.example.com/
export CONNECT_API_KEY=7C0947A852D8
quarto publish connect --id DDA36416-F950-4647-815C-01A24233E294 | {
"lastmod": "2023-07-05T19:35:15.759Z",
"loc": "https://quarto.org/docs/publishing/ci.html",
"source": "https://quarto.org/docs/publishing/ci.html"
} |
Overview
There are a wide variety of ways to publish Quarto websites. Other articles cover publishing to Quarto Pub, GitHub Pages, Netlify, and Posit Connect. Below we’ll describe some general guidelines as well as offer some specific advice for Firebase, Site44, and Amazon S3. We’ll mostly defer to the documentation provided by the various services, but will note any Quarto website specific configuration required.
The most important thing to understand is that website content is by default written to the _site sub-directory and book content to the _book directory (you can customize either using the output-dir option). Publishing is simply a matter of copying the output directory to a web server or web hosting service.
Rendering for Publish
Prior to publishing you should always to a final render of your project:
Terminal
quarto render
This is particularly important to remember because changes you make to shared site configuration (e.g. _quarto.yml) aren’t reflected across your entire site until your render the entire project. To ensure that your output is up to date before publishing you should always do a full quarto render.
Firebase
Google Firebase has a web hosting service that enables easy deployment of websites using a set of command line tools.
Firebase websites by default deploy content from the public directory of the Firebase project directory. This means that you should set the output-dir to "public" within _quarto.yml:
project:
type: website
output-dir: public
Site44
Site44 is a service that allows you to publish websites from within Dropbox folders. Site44 creates a Dropbox/Apps/site44 directory, and any folders within that directory are published as websites.
The recommended workflow for deploying Quarto websites to Site44 is to develop your website in a separate project directory, and then, when it’s ready for final publishing, copy the contents of the _site directory to the folder for your website.
Amazon S3
If you are a user of Amazon Web Services you can serve your website directly from Amazon S3. Note however that this option is a bit more technically involved than GitHub Pages, Netlify, or Site44. See the article on Hosting a Static Website on Amazon S3 for additional details.
Other Hosts
Any web server or web host can be used to deploy a Quarto website. Here’s a recent CNET roundup of other web hosts you could consider. You can also deploy a Quarto website on any internal (intranet) web server.
You can also render and publish Quarto websites using a Continuous Integration (CI) service. See the articles on Publishing with CI for additional details. | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/publishing/other.html",
"source": "https://quarto.org/docs/publishing/other.html"
} |
Overview
GitHub Pages is a website hosting service that enables you to publish content based on source code managed within a GitHub repository.
There are three ways to publish Quarto websites and documents to GitHub Pages:
Render sites on your local machine to the docs directory, check the rendered site into GitHub, and then configure your GitHub repo to publish from the docs directory.
Use the quarto publish command to publish content rendered on your local machine.
Use a GitHub Action to automatically render your files (a single Quarto document or a Quarto project) and publish the resulting content whenever you push a source code change to your repository.
We’ll cover each of these methods below, but first an important pre-requisite: you need to have a Git repository on your local machine that is synced to GitHub. The URL of the published website will be derived from the combination of your username and the repository name (e.g. https://username.github.io/reponame/).
You can optionally configure a custom domain for a GitHub Pages site, but before exploring that ground you should get your site up and running with the default domain.
Render to docs
The simplest way to publish using GitHub Pages is to render to the docs directory and then check that directory into your repository. If you prefer not to check rendered output into version control see the discussion of using Publish Command below.
To get started, change your project configuration to use docs as the output-dir. For example:
_quarto.yml
project:
type: website
output-dir: docs
Then, add a .nojekyll file to the root of your repository that tells GitHub Pages not to do additional processing of your published site using Jekyll (the GitHub default site generation tool):
Mac/Linux
Terminal
touch .nojekyll
Windows
Terminal
copy NUL .nojekyll
Now, render your site and push it to GitHub:
Terminal
quarto render
git push
Finally, configure your GitHub repository to publish from the docs directory of your main branch:
Once you’ve made this configuration change GitHub will trigger a deployment of your website. Your site will also be updated whenever you commit and push to main.
Publish Command
The quarto publish command is an easy way to publish locally rendered documents and websites. Before attempting to use quarto publish (either locally or from a GitHub Action) you should be sure to configure the Source Branch and Ignore Output as described below.
Source Branch
Before attempting to publish you should ensure that the Source branch for your repository is gh-pages and that the site directory is set to the repository root (/). You can modify these options in Settings : Pages for your repository. For example, if you already have a gh-pages branch:
If you do not already have a gh-pages branch, you can create one as follows. First, make sure you have committed all changes to your current working branch with git status. Then:
Terminal
git checkout --orphan gh-pages
git reset --hard # make sure you've committed changes before running this!
git commit --allow-empty -m "Initialising gh-pages branch"
git push origin gh-pages
Double-check that the last git push action has indeed set the Settings : Pages for your repository as expected in the previous figure. Get back to your original repository branch with, for example, git checkout main.
Ignoring Output
It’s important to note that you don’t need to check your _site or _book directory into version control (if you have done this in the past you know it makes for very messy diffs!). Before proceeding you should add the output directory of your project to .gitignore. For example:
.gitignore
/.quarto/
/_site/
If you’ve already checked these files into source control you may need to remove them explicitly:
Terminal
git rm -r _site
Publishing
Once you have configured the source branch and updated your .gitignore, navigate to the directory where your project / git repository is located, make sure you are not on the gh-pages branch, and execute the quarto publish command for GitHub Pages:
Terminal
quarto publish gh-pages
The publish command will confirm that you want to publish, render your content, copy the output to a special gh-pages branch, push that branch to GitHub, and then open a browser to view your site once it is deployed.
Private Sites
If you are publishing to a private (i.e. password protected) website then the logic within quarto publishthat waits for your site to be available before opening a browser won’t work correctly. In this case you should pass the --no-browser option to bypass this:
Terminal
quarto publish gh-pages --no-browser
Documents
To publish a document rather than a website or book, provide the path to the document (note that you can publish only one document from a given GitHub repository):
Terminal
quarto publish gh-pages document.qmd
Options
Here are all of the available command line options for quarto publish gh-pages:
Option
Behavior
--no-prompt
Do not prompt to confirm publish actions.
--no-browser
Do not open a browser after publish.
--no-render
Do not re-render prior to publish
GitHub Action
Using the quarto publish gh-pages command to publish locally rendered content is the most simple and straightforward way to publish. Another option is to use GitHub Actions to render and publish your site (you might prefer this if you want execution and/or rendering to be automatically triggered from commits).
There are a few different ways to approach rendering and publishing content. Below, we’ll provide a how-to guide for publishing with GitHub Actions. For more conceptual background on the various approaches, see the discussion on Rendering for CI.
Freezing Computations
To make sure that R, Python, and Julia code is only executed locally, configure your project to use Quarto’s freeze feature by adding this to your _quarto.yml:
_quarto.yml
execute:
freeze: auto
Now, fully re-render your site:
Terminal
quarto render
If you have executable code in your project you’ll notice that a _freeze directory has been created at the top level of your project. This directory stores the results of computations and should be checked in to version control. Whenever you change a .qmd file with executable code, it will automatically be re-run during your next render and the updated computations will be stored in _freeze.
Note that an alternative approach is to execute the code as part of the GitHub Action. For now we’ll keep things simpler by executing code locally and storing the computations by using freeze. Then, further below, we’ll cover Executing Code within a GitHub Action.
Publish Action
Before configuring the publishing action, it’s important that you run quarto publish gh-pages locally, once. This will create the _publish.yml configuration required by the subsequent invocations of the GitHub Action. To do this, run the following from within your project:
quarto publish gh-pages
Once you’ve completed a local publish, add a publish.yml GitHub Action to your project by creating this YAML file and saving it to .github/workflows/publish.yml:
.github/workflows/publish.yml
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
This action will run whenever you push to the main branch of your repository. It will also run when you manually trigger the action from the Actions tab of your repository. The action will render your content and publish it to GitHub Pages, thus you need to ensure that GitHub Actions has permission to write to your repository. This is done by checking the Read and write permissions box under Workflow permissions in the Actions section of your repository Settings.
Once you’ve done this, check all of the newly created files (including the _freeze directory) into your repository and then push to GitHub. A GitHub Pages site will be created for your repository, and every time you push a new change to the repository it will be automatically rebuilt to reflect the change. Consult the Pages section of your repository Settings to see what the URL and publish status for your site is.
Executing Code
If you prefer, you can also configure a GitHub Action to execute R, Python, or Julia code as part of rendering. While this might reflexively seem like the best approach, consider the following requirements imposed when you execute code within a CI service like GitHub Actions:
You need to reconstitute all of the dependencies (R, Python, or Julia plus the correct versions of required packages) in the CI environment.
If your code requires any special permissions (e.g. database or network access) those permissions also need to be present on the CI server.
Your project may contain documents that can no longer be easily executed (e.g. blog posts from several years ago that use older versions of packages). These documents may need to have freeze individually enabled for them to prevent execution on CI.
Prerequisites
The best way to ensure that your code can be executed within a GitHub Action is to use a virtual environment like venv or renv with your project (below we’ll provide example actions for each). If you aren’t familiar with using these tools check out the article on using Virtual Environments with Quarto to learn more.
Once you’ve decided to execute code within your GitHub Action you can remove the freeze: auto described above from your _quarto.yml configuration. Note that if you want to use freeze selectively for some documents or directories that is still possible (for a directory, create a _metadata.yml file in the directory and specify your freeze configuration there—this is what Quarto does by default for the posts folder of blog projects).
Example: Jupyter with venv
Here is a complete example of a GitHub Action that installs Python, Jupyter, and package dependencies from requirements.txt, then executes code and renders output to GitHub Pages:
.github/workflows/publish.yml
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install Python and Dependencies
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- run: pip install jupyter
- run: pip install -r requirements.txt
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Example: Knitr with renv
Here is a complete example of a GitHub Action that installs R and package dependencies from renv.lock, then executes code and renders output to GitHub Pages:
.github/workflows/publish.yml
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.2.0'
- name: Install R Dependencies
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Additional Options
It’s possible to have a Quarto project in a larger GitHub repository, where the Quarto project does not reside at the top-level directory. In this case, add a path input to the invocation of the publish action. For example:
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
path: subdirectory-to-use
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
By default, quarto publish will re-render your project before publishing it. However, if you store the rendered output in version control, you don’t need the GitHub action to re-render the project. In that case, add the option render: false to the publish action:
- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
render: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
See the full definition of the Quarto publish action to learn about other more advanced options.
User Site
In addition to creating sites tied to various repositories, you can also create a user site that is served from your root user domain (e.g. https://username.github.io). This is an ideal place to publish a blog or personal home page. To create a user site:
Create a Git repo with the name username.github.io (where “username” is your GitHub username) and sync it to your local machine.
Set the Source branch for your user site to gh-pages as described in Source Branch. | {
"lastmod": "2023-07-05T19:35:15.759Z",
"loc": "https://quarto.org/docs/publishing/github-pages.html",
"source": "https://quarto.org/docs/publishing/github-pages.html"
} |
Pre-release Feature
This feature is new in the upcoming Quarto 1.4 release. To use the feature now, you’ll need to download and install the Quarto pre-release.
Quarto v1.4 includes the following new features for Lua filters:
Relative paths in require() calls
In larger, more complex filters, it becomes useful to structure your Lua code in modules. Quarto v1.4 supports the use of relative paths in require() calls so that small modules can be easily created and reused.
For example:
filter.lua
local utility = require('./utils')
function Pandoc(doc)
-- process
end
Using relative paths this way in quarto makes it harder for multiple filters to accidentally create conflicting module names (as would eventually happen when using the standard Lua require('utils') syntax). It’s possible to refer to subdirectories and parent directories as well:
filter2.lua
local parsing = require('./utils/parsing')
function Pandoc(doc)
-- process
end
utils/parsing.lua
local utils = require("../utils")
-- ... | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/prerelease/1.4/lua_changes.html",
"source": "https://quarto.org/docs/prerelease/1.4/lua_changes.html"
} |
In Quarto 1.3, callouts are represented as a custom AST node. You can create callout AST nodes in Lua filters with the quarto.Callout constructor. The constructor takes a single parameter, a table with entries type, title, and content, as described below. In Lua filters, callouts are represented as a table with the following fields:
type: the type of callout: note, caution, warning, etc (optional in the constructor).
title: The callout title (if any) (optional in the constructor),
icon: the callout icon (or false if none) (optional in the constructor)
appearance: "minimal", "simple", or "default" (optional in the constructor)
collapse: whether to render the callout as collapsible (optional in the constructor, default false)
content: the content of the callout (a pandoc.Blocks object, or a plain list in the constructor) | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/prerelease/1.3/custom-ast-nodes/callout.html",
"source": "https://quarto.org/docs/prerelease/1.3/custom-ast-nodes/callout.html"
} |
In Quarto 1.3, tabsets are represented as a custom AST node. You can create conditional blocks in Lua filters with the quarto.Tabset constructor, with parameters tabs, level and attr as described above. In addition, you can use quarto.Tab to create the tab objects for the tabs field. quarto.Tab is more lenient with parameter types, converting strings to Blocks and Inlines as needed. In Lua filters, tabsets are represented as a table with the following fields:
tabs: a table containing the content for each tab. Each entry is a table with two entries: title (a pandoc.Inlines) and content (a pandoc.Blocks) (optional in the contructor, default value {})
level: the level of the tab headings to be used in rendering the tabset (optional in the constructor, default value 2)
attr: the Attr object for the resulting tabset div (optional in the constructor) | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/prerelease/1.3/custom-ast-nodes/tabset.html",
"source": "https://quarto.org/docs/prerelease/1.3/custom-ast-nodes/tabset.html"
} |
Pre-release Feature
This feature is new in the upcoming Quarto 1.3 release. To use the feature now, you’ll need to download and install the Quarto pre-release.
SVG Images
Starting in Quarto 1.3, we support rendering of PDF documents that include SVG files, automatically converting them to PDF images if rsvg-convert is available on the system path during rendering.
You can learn more about installing librsvg (which provides rsvg-convert), see https://wiki.gnome.org/Projects/LibRsvg. To install on specific platforms, follow the below instructions:
On MacOS, you an use Homebrew (https://formulae.brew.sh/formula/librsvg) brew install librsvg
Tarballs for Linux are available here: https://download.gnome.org/sources/librsvg/
On Windows, you can install using chocolatey: choco install rsvg-convert
Remote Images
Starting in Quarto 1.3, when rendering PDFs, Quarto will automatically fetch remote image references and properly embed them within the PDF.
Filenames with Modifiers
In quarto 1.3, the default filename for PDF files includes variants and modifiers, and so the following YAML front matter will work:
# example.qmd
format:
pdf+simple: default # generates example+simple.pdf
pdf: default # generates example.pdf | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/prerelease/1.3/pdf.html",
"source": "https://quarto.org/docs/prerelease/1.3/pdf.html"
} |
Navbar Tools
The navbar can now display a set of tools (e.g. social actions, GitHub view or edit actions, etc.), see Navbar Tools.
Responsive Navbar
We’ve updated the responsive behavior of the navbar to improve the usability of Quarto websites on mobile devices. Changes include:
When the items in a navbar collapse into a menu, we’ve moved the ‘hamburger’ button which controls the menu to the right side of the navbar. This makes it easier to access the menu on mobile devices.
When the items in a navbar collapse into a menu, we place the search icon on right side of the navbar (rather than placing in the collapsed menu). This makes search always available, even when on small screens.
Responsive Sidebar
We’ve updated the responsive behavior of the sidebar to improve the usability of Quarto websites on mobile devices. Changes include:
The collapsed sidebar now appears as a vertically smaller band which includes a ‘sidebar’ icon on the left side. Clicking this icon will expand the sidebar to full width. In addition, this collapsed view includes ‘breadcrumbs’ for the current page which allow simple navigation up the hierarchy.
When revealed, the sidebar will now animate from the side of the screen. | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/prerelease/1.3/website-nav.html",
"source": "https://quarto.org/docs/prerelease/1.3/website-nav.html"
} |
Overview
Quarto projects are directories that provide:
A way to render all or some of the files in a directory with a single command (e.g. quarto render myproject).
A way to share YAML configuration across multiple documents.
The ability to redirect output artifacts to another directory.
The ability to freeze rendered output (i.e. don’t re-execute documents unless they have changed).
In addition, projects can have special “types” that introduce additional behavior (e.g. websites or books).
Note
If you are just getting started with Quarto and/or you don’t have previous experience with markdown publishing systems, you probably want to skip learning about projects for now. Once you are comfortable with the basics, come back to this article to learn more.
Creating Projects
Use the quarto create-project command to create a new project. If you have an existing directory of documents that you want to treat as a project just invoke create-project with no arguments from within the directory:
Terminal
quarto create-project
To create a project in a new directory just provide a directory name on the command line:
Terminal
quarto create-project myproject
Shared Metadata
One of the most important features of Quarto Projects is the ability to share YAML metadata options across multiple documents. Shared metadata can be defined at both the project and directory level.
Project Metadata
All Quarto projects include a _quarto.yml configuration file. Any document rendered within the project directory will automatically inherit the metadata defined at the project level. Here is an example of what the _quarto.yml file might look like:
_quarto.yml
project:
output-dir: _output
toc: true
number-sections: true
bibliography: references.bib
format:
html:
css: styles.css
html-math-method: katex
pdf:
documentclass: report
margin-left: 30mm
margin-right: 30mm
Note that the project file contains both global options that apply to all formats (e.g. toc and bibliography) as well as format-specific options.
You can further customize project metadata based on different project profiles (e.g. development vs. production or creating multiple versions of a book or website). See the article on Project Profiles for additional details.
Directory Metadata
You can also define metadata that should be inherited by only files within a directory. To do this, add a _metadata.yml file to the directory where you want to share metadata. For example, the following _metadata.yml sets up default Revealjs options for a series of presentations and disables search for documents within the directory:
_metadata.yml
format:
revealjs:
menu: false
progress: false
search: false
Options provided within these files use the same schema as _quarto.yml and are merged with any options you’ve already provided in _quarto.yml.
Metadata Merging
Metadata defined within _quarto.yml, _metadata.yml, and document-level YAML options are merged together. Document level options take priority, followed by directory options and finally project-level options:
File
Role
_quarto.yml
Project level default options
dir/_metadata.yml
Directory level default options (overrides project)
dir/document.qmd
Document options (overrides directory and project)
Note that when metadata is combined, objects and arrays are merged rather than simply overwriting each other. For example, here is how project and directory level options that affect output format and bibliographies would be merged:
_quarto.yml
format:
html:
toc: true
bibliography:
- refs.bib
dir/_metadata.yml
format:
html:
code-fold: true
bibliography:
- proj.bib
merged
format:
html:
toc: true
code-fold: true
bibliography:
- refs.bib
- proj.bib
Metadata Includes
You might find it convenient to break your metadata into multiple files. You can do this using the metadata-files option. For example, here we include some website options within a _quarto.yml:
_quarto.yml
project:
type: website
metadata-files:
- _website.yml
_website.yml
website:
navbar:
background: primary
left:
- href: index.qmd
text: Home
- about.qmd
Files listed in metadata-files are merged with the parent file in the same fashion that project, directory, and document options are merged. This means that included files can both provide new options as well as combine with existing options.
Local Config
Sometimes its useful to define local changes to project configuration that are not checked in to version control. You can do this by creating a _quarto.yml.local config file. For example, here we specify that we want to use the execution cache when running locally:
_quarto.yml.local
execute:
cache: true
Note that Quarto automatically writes an entry to .gitignore to ensure that .local files are not committed (note that environment variables can also be defined in a similar .local file).
Rendering Projects
You can render files within a project either one-by-one or all at once (in either case, shared project metadata will be used).
To render all of the documents within a project, just use quarto render within the project directory (or target a specific directory with a command line argument):
Terminal
# render project in current dir
quarto render
# render project in 'myproject'
quarto render myproject
You can also render only the files within a sub-directory of a project. For example, if the current directory contains a project with sub-directories tutorials, how-to, and articles, you can render just the contents of articles as follows:
Terminal
# render only documents in the 'articles' sub-directory
quarto render articles
Note that when rendering a project, command line arguments you pass to quarto render will be used for each file in the project. For example. this command will render only the PDF format:
Terminal
quarto render --to pdf
quarto render myproject --to pdf
If you are working with Quarto from R, you can also render a project from the R console using the quarto R package.
library(quarto)
quarto_render()
Render Targets
By default, all valid Quarto input files (.qmd, .ipynb, .md, .Rmd) in the project directory will be rendered, save for ones with:
A file or directory prefix of . (hidden files)
A file or directory prefix of _ (typically used for non top-level files, e.g. ones included in other files)
Files named README.md or README.qmd (which are typically not actual render targets but rather informational content about the source code to be viewed in the version control web UI).
If you don’t want to render all of the target documents in a project, or you wish to control the order of rendering more precisely, you can add a project: render: [files] entry to your project metadata. For example:
project:
render:
- section1.qmd
- section2.qmd
Note that you can use wildcards when defining the render list. For example:
project:
render:
- section*.qmd
You can also use the prefix ! to ignore some paths in the render list. Note that in that case you need to start by specifying everything you do want to render. For example:
project:
render:
- "*.qmd"
- "!ignored.qmd"
- "!ignored-dir/"
Note
If the name of your output file needs to start with . or _ (for instance _index.md for Hugo users), you must name the Quarto input file without the prefix (for instance index.qmd) and add an explicit output-file parameter in the YAML such as
---
output-file: _index.md
---
Learning More
These articles provide additional documentation on more advanced features of Quarto projects:
Managing Execution covers various techniques you can use to minimize the time required to rebuild a site that has expensive computations.
Project Profiles describes how you can adapt both the options and content of your projects for different scenarios (e.g. development vs. production or creating multiple versions of a book or website).
Environment Variables covers how to define environment variables that should set whenever your project is rendered (including how to vary those variables by project profile and/or for use in local development).
Project Scripts describes how to add periodic or pre/post render scripts to projects for special processing of input data and project outputs.
Virtual Environments explores how to create project-specific package libraries, which helps with faithfully reproducing your environment over time as well as ensuring that upgrading a package in one project doesn’t break other projects. | {
"lastmod": "2023-07-05T19:35:15.755Z",
"loc": "https://quarto.org/docs/projects/quarto-projects.html",
"source": "https://quarto.org/docs/projects/quarto-projects.html"
} |
Overview
Project profiles enable you to adapt the options, environment, and content of your projects for different scenarios. For example:
You may want to have distinct execution behavior when running on a production server. For example, you may want to use freeze or cache when rendering locally but always execute all of the code when running on a CI server.
You may want to provide distinct access credentials for databases or web services depending on the profile.
You may want to create different versions of a book from the same source code (e.g. a basic and advanced version)
When a project profile is activated a number of things occur:
Profile specific config is merged with the top-level _quarto.yml
Profile specific environment variables are applied.
Divs and Spans can use the when-profile attribute to target content specifically for that project.
The QUARTO_PROFILE environment variable includes the profile name so that other code (e.g. Python or R code) can condition its behavior on the active profile.
Examples
Here’s an example of a _quarto.yml file that is extended by a production configuration defined in _quarto-production.yml. When activated, the production profile overrides the default rendering execution behavior (disabling the use of freeze):
_quarto.yml
project:
type: website
execute:
freeze: true
_quarto-production.yml
execute:
freeze: false
When the production profile is active, its configuration will be merged over the default project config (in this case resulting in the use of the frozen computational results being disabled).
Here’s an example of using the when-profile attribute to include content only when the advanced profile is active:
::: {.content-visible when-profile="advanced"}
This content will only appear in the advanced version.
:::
The next section covers how to activate profiles, then subsequent sections go into more depth on the various capabilities of profiles.
Activating Profiles
One or more named profiles can be activated by using either the QUARTO_PROFILE environment variable or the --profile command line argument.
Here we activate a profile using the QUARTO_PROFILE environment variable:
Terminal
export QUARTO_PROFILE=production
quarto render
Here we activate a profile by passing the --profile argument on the Quarto command line:
Terminal
quarto render --profile production
The use of the --profile command line argument entirely replaces any defined QUARTO_PROFILE within the environment.
Note that more than one profile can be activated at once. For example, here we activate both the production and advanced profiles:
Terminal
quarto render --profile production,advanced
Profile Configuration
Define profile-specific configuration by adding an additional project file that includes the name of the profile (for example, _quarto-advanced.yml for the advanced profile). For example, here we customize the title and output-dir based on the currently active profile:
_quarto.yml
project:
title: "My Website"
type: website
_quarto-advanced.yml
project:
title: "My Website (Advanced)"
output-dir: _site-advanced
It’s important to note that multiple profiles can be active. So the following enables you to vary configuration based on both advanced and production profiles:
_quarto.yml
project:
title: "My Website"
type: website
execute:
freeze: true
_quarto-advanced.yml
project:
title: "My Website (Advanced)"
output-dir: _site-advanced
_quarto-production.yml
execute:
freeze: false
The advanced and production profiles would each be applied if you specify them both:
Terminal
# multiple profiles in environment
export QUARTO_PROFILE=advanced,production
# multiple profiles on command line
quarto render --profile advanced,production
Profile Content
You can also specify that content within your project only be included when a certain profile is active. You do this using the .content-visible class along with the when-profile attribute to a div or span. For example, here we defined a div that is included only for the advanced profile:
::: {.content-visible when-profile="advanced"}
This content will only appear in the advanced version.
:::
You can also exclude content from a given profile using the unless-profile attribute. Here we include content only when the profile is not advanced:
::: {.content-visible unless-profile="advanced"}
This content will appear in all versions save for advanced.
:::
It might be more clear to re-write the above using .content-hidden:
::: {.content-hidden when-profile="advanced"}
This content will be hidden in the advanced profile
:::
You can also use these attributes with spans. For example:
[Only in advanced]{.content-visible when-profile="advanced"}
Profile Groups
Often times a set of profile names form a mutually exclusive group, and you want to make sure that at least one of the profiles is always active. For example, here we define distinct chapter lists for basic and advanced profiles, along with a profile group entry indicating that they form a group:
_quarto.yml
project:
type: book
book:
title: "My Book"
author: "Norah Jones"
profile:
group:
- [basic, advanced]
_quarto-basic.yml
book:
chapters:
- intro.qmd
- using.qmd
- summary.qmd
_quarto-advanced.yml
book:
chapters:
- intro.qmd
- using.qmd
- advanced.qmd
- summary.qmd
You’ll note that the base options for book do not include a chapter list (as we rely on the profiles for distinct lists). This means that to successfully render the project, you always need to have a profile defined—this might be inconvenient especially for local authoring and preview.
By specifying a group we indicate that one of the profiles must be defined, and that the first one listed should be used as the default when no others are present.
Default Profile
When authoring a Quarto project that uses profiles you might want to change which profile(s) are rendered by default to try out different variations of the project.
While you could certainly do this by defining environment variables in your shell, this isn’t particularly convenient when using the integrated render and preview functionality in VS Code and RStudio.
To define a default profile that is used when an explicit QUARTO_PROFILE or --profile CLI argument is not present, add a default option to the profile key. For example, here we indicate that development should be the active profile is not otherwise specified:
_quarto.yml
profile:
default: development | {
"lastmod": "2023-07-05T19:35:15.755Z",
"loc": "https://quarto.org/docs/projects/profiles.html",
"source": "https://quarto.org/docs/projects/profiles.html"
} |
Overview
Rendering a list of input files has the potential to be quite time consuming depending on the computations required. There are a number of techniques you can use to minimize the time required to rebuild a site that has expensive computations.
Incremental Render
When working on a project you are typically iterating on a single document at a time. You can render a single file (or single directory or list of files) incrementally by specifying it on the command-line:
Terminal
quarto render introduction.qmd
quarto render subdir/
Even though you are rendering only part of the project, any associated project-handling code is still executed. So for example in a book project the entire book is still produced (using previously rendered versions of the other chapters).
Freeze
You can use the freeze option to denote that computational documents should never be re-rendered during a global project render, or alternatively only be re-rendered when their source file changes:
execute:
freeze: true # never re-render during project render
execute:
freeze: auto # re-render only when source changes
Note that freeze controls whether execution occurs during global project renders. If you do an incremental render of either a single document or a project sub-directory then code is always executed. For example:
Terminal
# render single document (always executes code)
quarto render document.qmd
# render project subdirectory (always executes code)
quarto render articles
Using Freeze
Freeze is generally used when you have either a large number of collaborators or many computational documents created over a longer period of time. In both cases it can be challenging to fully re-execute every document when you render the site. This could be because some documents have esoteric or environment-specific requirements (e.g. require access/authentication to a data source) or due to general fragility of dependencies over time. Using freeze ensures that you can always reproducibly render your site.
The computational results of documents executed with freeze are stored in the _freeze directory, and re-used when needed to fulfill document renders. You should check the contents of _freeze into version control so that others rendering the project don’t need to reproduce your computational environment to render it in their environment.
Note that you’ll still want to take care to fully re-render your project when things outside of source code change (e.g. input data). You can remove previously frozen output by deleting the _freeze folder at the root of yourproject.
Virtual Environments
You can also combine freeze with the use of virtual environments to divide your project into sub-directories that each have their own set of dependencies. This allows multiple collaborators to use a set of localized dependencies for the documents they are responsible for, but at the same time still be able to render the entire project without requiring all of its dependencies.
To learn how to create and use a virtual environment, see the full documentation on Virtual Environments
Here’s an example workflow of using virtual environments with freeze:
Include freeze: true in the project execution options:
execute:
freeze: true
Create a sub-directory of documents (e.g. research), and initialize and use a virtual environment within it:
research/
document1.qmd
document2.qmd
env/
requirements.txt
When working within this sub-directory, activate the virtual environment before rendering its documents. For example:
Terminal
cd research
source env/bin/activate
quarto render # render all files in subdir
quarto render document.qmd # render a single-file
This sub-directory render won’t use the cached freeze results but instead will re-run all of the computations using the directory-specific virtual environment. You can of course also include sub-directories within this directory and their documents will also be rendered using the parent virtual environment.
Cache
You can use the cache option to cache the results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents):
execute:
cache: true
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined). You may however need to manually refresh the cache if you know that some other input (or even time) has changed sufficiently to warrant an update. To do this, render either individual files or an entire project using the --cache-refresh option:
Terminal
quarto render mydoc.qmd --cache-refresh # single doc
quarto render --cache-refresh # entire project
Notebooks
Note that when rendering an .ipynb Quarto will not execute the cells within the notebook by default (the presumption being that you already executed them while editing the notebook). If you want to execute the cells you can pass the --execute flag to render:
Terminal
quarto render notebook.ipynb --execute
You can also specify this behavior within the notebook’s YAML front matter:
---
title: "My Notebook"
execute:
enabled: true
---
Working Dir
By default, the working directory for rendering files within a project is the directory of the file itself. If you prefer to use the main project directory instead, you can add the execute-dir: project option to your config:
project:
execute-dir: project
Note that from within your code you can always determine the location of the currently executing Quarto project using the QUARTO_PROJECT_DIR environment variable. | {
"lastmod": "2023-07-05T19:35:15.755Z",
"loc": "https://quarto.org/docs/projects/code-execution.html",
"source": "https://quarto.org/docs/projects/code-execution.html"
} |
Overview
You can create PowerPoint presentations using the pptx format. PowerPoint presentations support core presentation features like incremental bullets, 2-column layouts, and speaker notes, and can also be rendered using custom PowerPoint templates.
See the PowerPoint format reference for a complete list of all options available for PowerPoint output.
Creating Slides
In markdown, slides are delineated using headings. For example, here is a simple slide show with two slides (each defined with a level 2 heading (##):
---
title: "Habits"
author: "John Doe"
format: pptx
---
## Getting up
- Turn off alarm
- Get out of bed
## Going to sleep
- Get in bed
- Count sheep
You can also divide slide shows into sections with title slides using a level 1 header (#). For example:
---
title: "Habits"
author: "John Doe"
format: pptx
---
# In the morning
## Getting up
- Turn off alarm
- Get out of bed
## Breakfast
- Eat eggs
- Drink coffee
# In the evening
## Dinner
- Eat spaghetti
- Drink wine
## Going to sleep
- Get in bed
- Count sheep
Finally, you can also delineate slides using horizontal rules (for example, if you have a slide without a title):
---
title: "Habits"
author: "John Doe"
format: pptx
---
- Turn off alarm
- Get out of bed
---
- Get in bed
- Count sheep
The examples above all use level 2 headings for slides and level 1 headings for sections/title slides. You can customize this using the slide-level option (See the Pandoc documentation on structuring the slide show for additional details.
Incremental Lists
By default number and bullet lists within slides are displayed all at once. You can override this globally using the incremental option. For example:
title: "My Presentation"
format:
pptx:
incremental: true
You can also explicitly make any list incremental or non-incremental by surrounding it in a div with an explicit class that determines the mode. To make a list incremental do this:
::: {.incremental}
- Eat spaghetti
- Drink wine
:::
To make a list non-incremental do this:
::: {.nonincremental}
- Eat spaghetti
- Drink wine
:::
Multiple Columns
To put material in side by side columns, you can use a native div container with class .columns, containing two or more div containers with class .column and a width attribute:
:::: {.columns}
::: {.column width="40%"}
contents...
:::
::: {.column width="60%"}
contents...
:::
::::
Speaker Notes
You can add speaker notes to a slide using a div with class .notes. For example:
## Slide with speaker notes
Slide content
::: {.notes}
Speaker notes go here.
:::
PowerPoint Templates
By default PowerPoint output uses a fairly plain looking template. You can customize what template is used via the reference-doc option. For example:
---
title: "Presentation"
format:
pptx:
reference-doc: template.pptx
---
Nearly all templates included with recent versions of PowerPoint (either with .pptx or .potx extension) are known to work, as are most templates derived from these.
The specific requirement is that the template should contain layouts with the following names (as seen within PowerPoint, click on Layout under the Home menu to check):
Title Slide
Title and Content
Section Header
Two Content
Comparison
Content with Caption
Blank
For each name, the first layout found with that name will be used. If no layout is found with one of the names, Pandoc will output a warning and use the layout with that name from the default reference-doc instead.
Creating a Template
To create a template from scratch, start with the default PowerPoint template as follows:
Terminal
quarto pandoc -o template.pptx --print-default-data-file reference.pptx
Then edit the template.pptx file within PowerPoint as desired, and use it as the value for reference-doc (as shown above) when rendering your slides:
Slide Layouts
When creating slides, the pptx writer chooses from a number of pre-defined layouts, based on the content of the slide:
Title Slide
This layout is used for the initial slide, which is generated and filled from the metadata fields date, author, and title, if they are present.
Section Header
This layout is used for what pandoc calls “title slides”, i.e. slides which start with a header which is above the slide level in the hierarchy.
Two Content
This layout is used for two-column slides, i.e. slides containing a div with class columns which contains at least two divs with class column.
Comparison
This layout is used instead of “Two Content” for any two-column slides in which at least one column contains text followed by non-text (e.g. an image or a table).
Content with Caption
This layout is used for any non-two-column slides which contain text followed by non-text (e.g. an image or a table).
Blank
This layout is used for any slides which only contain blank content, e.g. a slide containing only speaker notes, or a slide containing only a non-breaking space.
Title and Content
This layout is used for all slides which do not match the criteria for another layout.
These layouts are chosen from the default pptx reference doc included with Pandoc, unless an alternative reference doc is specified using reference-doc.
Background Images
To provide a common background image for multiple slides in a PowerPoint presentation, include the background image within the relevant slide layouts of a custom PowerPoint template (see Creating a Template for details on creating templates).
To add a background image to an individual slide, add the background-image attribute to the slide’s heading. For example:
## Slide Title {background-image="background.png"}
Note that this also works even if you don’t have slide heading text. For example:
## {background-image="background.png"}
For background images, only the “stretch” mode is supported, and the background image is centred around the slide in the image’s larger axis, matching the observed default behaviour of PowerPoint. | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/presentations/powerpoint.html",
"source": "https://quarto.org/docs/presentations/powerpoint.html"
} |
Overview
You can create Beamer (LaTeX/PDF) presentations using the beamer format. Beamer presentations support core presentation features like incremental content and 2-column layouts, and also provide facilities for customizing column layout, specifying frame attributes, and using Beamer themes.
See the Beamer format reference for a complete list of all options available for Beamer output.
Creating Slides
In markdown, slides are delineated using headings. For example, here is a simple slide show with two slides (each defined with a level 2 heading (##):
---
title: "Habits"
author: "John Doe"
format: beamer
---
## Getting up
- Turn off alarm
- Get out of bed
## Going to sleep
- Get in bed
- Count sheep
You can also divide slide shows into sections with title slides using a level 1 header (#). For example:
---
title: "Habits"
author: "John Doe"
format: beamer
---
# In the morning
## Getting up
- Turn off alarm
- Get out of bed
## Breakfast
- Eat eggs
- Drink coffee
# In the evening
## Dinner
- Eat spaghetti
- Drink wine
## Going to sleep
- Get in bed
- Count sheep
Finally, you can also delineate slides using horizontal rules (for example, if you have a slide without a title):
---
title: "Habits"
author: "John Doe"
format: beamer
---
- Turn off alarm
- Get out of bed
---
- Get in bed
- Count sheep
The examples above all use level 2 headings for slides and level 1 headings for sections/title slides. You can customize this using the slide-level option (See the Pandoc documentation on structuring the slide show for additional details.
Incremental Lists
By default number and bullet lists within slides are displayed all at once. You can override this globally using the incremental option. For example:
title: "My Presentation"
format:
beamer:
incremental: true
You can also explicitly make any list incremental or non-incremental by surrounding it in a div with an explicit class that determines the mode. To make a list incremental do this:
::: {.incremental}
- Eat spaghetti
- Drink wine
:::
To make a list non-incremental do this:
::: {.nonincremental}
- Eat spaghetti
- Drink wine
:::
You can also insert a pause within a slide (keeping the content after the pause hidden) by inserting three dots separated by spaces:
## Slide with a pause
content before the pause
. . .
content after the pause
Multiple Columns
To put material in side by side columns, you can use a native div container with class .columns, containing two or more div containers with class .column and a width attribute:
:::: {.columns}
::: {.column width="40%"}
contents...
:::
::: {.column width="60%"}
contents...
:::
::::
The div containers with classes columns and column can optionally have an align attribute. The class columns can optionally have a totalwidth attribute or an onlytextwidth class.
:::: {.columns align=center totalwidth=8em}
::: {.column width="40%"}
contents...
:::
::: {.column width="60%" align=bottom}
contents...
:::
::::
The align attributes on columns and column can be used with the values top, top-baseline, center and bottom to vertically align the columns. It defaults to top in columns.
The totalwidth attribute limits the width of the columns to the given value.
:::: {.columns align=top .onlytextwidth}
::: {.column width="40%" align=center}
contents...
:::
::: {.column width="60%"}
contents...
:::
::::
The class onlytextwidth sets the totalwidth to \textwidth.
See Section 12.7 of the Beamer User’s Guide for more details.
Beamer Options
These variables change the appearance of PDF slides using beamer.
aspectratio
slide aspect ratio (43 for 4:3 [default], 169 for 16:9, 1610 for 16:10, 149 for 14:9, 141 for 1.41:1, 54 for 5:4, 32 for 3:2)
beamerarticle
produce an article from Beamer slides
beameroption
add extra beamer option with \setbeameroption{}
institute
author affiliations: can be a list when there are multiple authors
logo
logo image for slides
navigation
controls navigation symbols (default is empty for no navigation symbols; other valid values are frame, vertical, and horizontal)
section-titles
enables “title pages” for new sections (default is true)
theme, colortheme, fonttheme, innertheme, outertheme
beamer themes
themeoptions
options for LaTeX beamer themes (a list).
titlegraphic
image for title slide
For example, here we use several of these options:
---
title: "Presentation"
format:
beamer:
aspectratio: 32
navigation: horizontal
theme: AnnArbor
colortheme: lily
---
Frame Attributes
Sometimes it is necessary to add the LaTeX [fragile] option to a frame in beamer (for example, when using the minted environment). This can be forced by adding the fragile class to the heading introducing the slide:
# Fragile slide {.fragile}
All of the other frame attributes described in Section 8.1 of the Beamer User’s Guide may also be used: allowdisplaybreaks, allowframebreaks, b, c, t, environment, label, plain, shrink, standout, noframenumbering.
Background Images
To provide a common background image for all slides in a Beamer presentation, use the background-image format option. For example:
---
format:
beamer:
background-image: background.png | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/presentations/beamer.html",
"source": "https://quarto.org/docs/presentations/beamer.html"
} |
Quarto Presentations
Create beautiful interactive slide decks with Reveal.js
Hello, There
This presentation will show you examples of what you can do with Quarto and Reveal.js, including:
Presenting code and LaTeX equations
Including computations in slide output
Image, video, and iframe backgrounds
Fancy transitions and animations
Printing to PDF
…and much more
Pretty Code
Over 20 syntax highlighting themes available
Default theme optimized for accessibility
# Define a server for the Shiny app
function(input, output) {
# Fill in the spot we created for a plot
output$phonePlot <- renderPlot({
# Render a barplot
})
}
Learn more: Syntax Highlighting
Code Animations
Over 20 syntax highlighting themes available
Default theme optimized for accessibility
# Define a server for the Shiny app
function(input, output) {
# Fill in the spot we created for a plot
output$phonePlot <- renderPlot({
# Render a barplot
barplot(WorldPhones[,input$region]*1000,
main=input$region,
ylab="Number of Telephones",
xlab="Year")
})
}
Learn more: Code Animations
Line Highlighting
Highlight specific lines for emphasis
Incrementally highlight additional lines
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
Learn more: Line Highlighting
Executable Code
library(ggplot2)
ggplot(mtcars, aes(hp, mpg, color = am)) +
geom_point() + geom_smooth(formula = y ~ x, method = "loess")
Learn more: Executable Code
LaTeX Equations
MathJax rendering of equations to HTML
\begin{gather*}
a_1=b_1+c_1\\
a_2=b_2+c_2-d_2+e_2
\end{gather*}
\begin{align}
a_{11}& =b_{11}&
a_{12}& =b_{12}\\
a_{21}& =b_{21}&
a_{22}& =b_{22}+c_{22}
\end{align}
\[\begin{gather*}
a_1=b_1+c_1\\
a_2=b_2+c_2-d_2+e_2
\end{gather*}\]
\[\begin{align}
a_{11}& =b_{11}&
a_{12}& =b_{12}\\
a_{21}& =b_{21}&
a_{22}& =b_{22}+c_{22}
\end{align}\]
Learn more: LaTeX Equations
Column Layout
Arrange content into columns of varying widths:
Motor Trend Car Road Tests
The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles.
mpg
cyl
disp
hp
wt
Mazda RX4
21.0
6
160
110
2.620
Mazda RX4 Wag
21.0
6
160
110
2.875
Datsun 710
22.8
4
108
93
2.320
Hornet 4 Drive
21.4
6
258
110
3.215
Hornet Sportabout
18.7
8
360
175
3.440
Valiant
18.1
6
225
105
3.460
Learn more: Multiple Columns
Incremental Lists
Lists can optionally be displayed incrementally:
First item
Second item
Third item
Insert pauses to make other types of content display incrementally.
Learn more: Incremental Lists
Fragments
Incremental text display and animation with fragments:
Fade in
Slide up while fading in
Slide left while fading in
Fade in then semi out
Strike
Highlight red
Learn more: Fragments
Slide Backgrounds
Set the background attribute on a slide to change the background color (all CSS color formats are supported).
Different background transitions are available via the background-transition option.
Learn more: Slide Backgrounds
Media Backgrounds
You can also use the following as a slide background:
An image: background-image
A video: background-video
An iframe: background-iframe
Learn more: Media Backgrounds
Absolute Position
Position images or other elements at precise locations
Learn more: Absolute Position
Auto-Animate
Automatically animate matching elements across slides with Auto-Animate.
Learn more: Auto-Animate
Auto-Animate
Automatically animate matching elements across slides with Auto-Animate.
Learn more: Auto-Animate
Slide Transitions
The next few slides will transition using the slide transition
Transition
Description
none
No transition (default, switch instantly)
fade
Cross fade
slide
Slide horizontally
convex
Slide at a convex angle
concave
Slide at a concave angle
zoom
Scale the incoming slide so it grows in from the center of the screen.
Learn more: Slide Transitions
Tabsets
PlotData
mpg
cyl
disp
hp
drat
wt
qsec
vs
am
gear
carb
Mazda RX4
21.0
6
160.0
110
3.90
2.620
16.46
0
1
4
4
Mazda RX4 Wag
21.0
6
160.0
110
3.90
2.875
17.02
0
1
4
4
Datsun 710
22.8
4
108.0
93
3.85
2.320
18.61
1
1
4
1
Hornet 4 Drive
21.4
6
258.0
110
3.08
3.215
19.44
1
0
3
1
Hornet Sportabout
18.7
8
360.0
175
3.15
3.440
17.02
0
0
3
2
Valiant
18.1
6
225.0
105
2.76
3.460
20.22
1
0
3
1
Duster 360
14.3
8
360.0
245
3.21
3.570
15.84
0
0
3
4
Merc 240D
24.4
4
146.7
62
3.69
3.190
20.00
1
0
4
2
Merc 230
22.8
4
140.8
95
3.92
3.150
22.90
1
0
4
2
Merc 280
19.2
6
167.6
123
3.92
3.440
18.30
1
0
4
4
Merc 280C
17.8
6
167.6
123
3.92
3.440
18.90
1
0
4
4
Merc 450SE
16.4
8
275.8
180
3.07
4.070
17.40
0
0
3
3
Merc 450SL
17.3
8
275.8
180
3.07
3.730
17.60
0
0
3
3
Merc 450SLC
15.2
8
275.8
180
3.07
3.780
18.00
0
0
3
3
Cadillac Fleetwood
10.4
8
472.0
205
2.93
5.250
17.98
0
0
3
4
Lincoln Continental
10.4
8
460.0
215
3.00
5.424
17.82
0
0
3
4
Chrysler Imperial
14.7
8
440.0
230
3.23
5.345
17.42
0
0
3
4
Fiat 128
32.4
4
78.7
66
4.08
2.200
19.47
1
1
4
1
Honda Civic
30.4
4
75.7
52
4.93
1.615
18.52
1
1
4
2
Toyota Corolla
33.9
4
71.1
65
4.22
1.835
19.90
1
1
4
1
Toyota Corona
21.5
4
120.1
97
3.70
2.465
20.01
1
0
3
1
Dodge Challenger
15.5
8
318.0
150
2.76
3.520
16.87
0
0
3
2
AMC Javelin
15.2
8
304.0
150
3.15
3.435
17.30
0
0
3
2
Camaro Z28
13.3
8
350.0
245
3.73
3.840
15.41
0
0
3
4
Pontiac Firebird
19.2
8
400.0
175
3.08
3.845
17.05
0
0
3
2
Fiat X1-9
27.3
4
79.0
66
4.08
1.935
18.90
1
1
4
1
Porsche 914-2
26.0
4
120.3
91
4.43
2.140
16.70
0
1
5
2
Lotus Europa
30.4
4
95.1
113
3.77
1.513
16.90
1
1
5
2
Ford Pantera L
15.8
8
351.0
264
4.22
3.170
14.50
0
1
5
4
Ferrari Dino
19.7
6
145.0
175
3.62
2.770
15.50
0
1
5
6
Maserati Bora
15.0
8
301.0
335
3.54
3.570
14.60
0
1
5
8
Volvo 142E
21.4
4
121.0
109
4.11
2.780
18.60
1
1
4
2
Learn more: Tabsets
Interactive Slides
Include Jupyter widgets and htmlwidgets in your presentations
Learn more: Jupyter widgets, htmlwidgets
Interactive Slides
Turn presentations into applications with Observable and Shiny. Use component layout to position inputs and outputs.
viewof talentWeight = Inputs.range([-2, 2], { value: 0.7, step: 0.01, label: "talent weight" })
viewof looksWeight = Inputs.range([-2, 2], { value: 0.7, step: 0.01, label: "looks weight" })
viewof minimum = Inputs.range([-2, 2], { value: 1, step: 0.01, label: "min fame" })
import { plotActors } from './actors.js';
plotActors(actors, talentWeight, looksWeight, minimum)
Learn more: Observable, Shiny, Component Layout
Preview Links
Navigate to hyperlinks without disrupting the flow of your presentation.
Use the preview-links option to open links in an iframe on top of your slides. Try clicking the link below for a demonstration:
Matplotlib: Visualization with Python
Learn more: Preview Links
Themes
10 Built-in Themes (or create your own)
Learn more: Themes
Easy Navigation
Quickly jump to other parts of your presentation
Toggle the slide menu with the menu button (bottom left of slide) to go to other slides and access presentation tools.
You can also press m to toggle the menu open and closed.
Learn more: Navigation
Chalkboard
Free form drawing and slide annotations
Use the chalkboard button at the bottom left of the slide to toggle the chalkboard.
Use the notes canvas button at the bottom left of the slide to toggle drawing on top of the current slide.
You can also press b to toggle the chalkboard or c to toggle the notes canvas.
Learn more: Chalkboard
Point of View
Press o to toggle overview mode:
Hold down the Alt key (or Ctrl in Linux) and click on any element to zoom towards it—try it now on this slide.
Learn more: Overview Mode, Slide Zoom
Speaker View
Press s (or use the presentation menu) to open speaker view
Learn more: Speaker View
Authoring Tools
Live side-by-side preview for any notebook or text editor including Jupyter and VS Code
Learn more: Jupyter, VS Code, Text Editors
Authoring Tools
RStudio includes an integrated presentation preview pane
Learn more: RStudio
And More…
Touch optimized (presentations look great on mobile, swipe to navigate slides)
Footer & Logo (optionally specify custom footer per-slide)
Auto-Slide (step through slides automatically, without any user input)
Multiplex (allows your audience to follow the slides of the presentation you are controlling on their own phone, tablet or laptop).
Learn more: Quarto Presentations
https://quarto.org | {
"lastmod": "2023-07-05T19:35:15.739Z",
"loc": "https://quarto.org/docs/presentations/revealjs/demo/index.html",
"source": "https://quarto.org/docs/presentations/revealjs/demo/index.html"
} |
Animating content
Animating content | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/demo/mini/auto-animate.html",
"source": "https://quarto.org/docs/presentations/revealjs/demo/mini/auto-animate.html"
} |
Animation
Implicit
Animation | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/demo/mini/auto-animate-movement.html",
"source": "https://quarto.org/docs/presentations/revealjs/demo/mini/auto-animate-movement.html"
} |
{
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/demo/mini/zoom.html",
"source": "https://quarto.org/docs/presentations/revealjs/demo/mini/zoom.html"
} |
|
Element Matching with data-id
Element Matching with data-id | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/demo/mini/auto-animate-stack.html",
"source": "https://quarto.org/docs/presentations/revealjs/demo/mini/auto-animate-stack.html"
} |
Overview
You can create Revealjs presentations using the revealjs format. The best way to get a sense for the capabilities of Revealjs is this demo presentation:
If you prefer to view the demo in a standalone browser you can do that here. Check out the source code for the demo to see how the slides were created.
See the Revealjs format reference for a comprehensive overview of all options supported for Revealjs output.
Creating Slides
In markdown, slides are delineated using headings. For example, here is a simple slide show with two slides (each defined with a level 2 heading (##):
---
title: "Habits"
author: "John Doe"
format: revealjs
---
## Getting up
- Turn off alarm
- Get out of bed
## Going to sleep
- Get in bed
- Count sheep
You can also divide slide shows into sections with title slides using a level 1 header (#). For example:
---
title: "Habits"
author: "John Doe"
format: revealjs
---
# In the morning
## Getting up
- Turn off alarm
- Get out of bed
## Breakfast
- Eat eggs
- Drink coffee
# In the evening
## Dinner
- Eat spaghetti
- Drink wine
## Going to sleep
- Get in bed
- Count sheep
Finally, you can also delineate slides using horizontal rules (for example, if you have a slide without a title):
---
title: "Habits"
author: "John Doe"
format: revealjs
---
- Turn off alarm
- Get out of bed
---
- Get in bed
- Count sheep
The examples above all use level 2 headings for slides and level 1 headings for sections/title slides. You can customize this using the slide-level option (See the Pandoc documentation on structuring the slide show for additional details.
Title Slide
You’ll notice in the above examples that a title slide is automatically created based on the title and author provided in the document YAML options. However, sometimes you don’t want an explicit title slide (e.g. if your first slide consists entirely of a background image). It’s perfectly valid to create a presentation without a title slide, just exclude the title and author options:
---
format: revealjs
---
## Getting up
- Turn off alarm
- Get out of bed
## Going to sleep
- Get in bed
- Count sheep
Incremental Lists
By default number and bullet lists within slides are displayed all at once. You can override this globally using the incremental option. For example:
title: "My Presentation"
format:
revealjs:
incremental: true
You can also explicitly make any list incremental or non-incremental by surrounding it in a div with an explicit class that determines the mode. To make a list incremental do this:
::: {.incremental}
- Eat spaghetti
- Drink wine
:::
To make a list non-incremental do this:
::: {.nonincremental}
- Eat spaghetti
- Drink wine
:::
You can also insert a pause within a slide (keeping the content after the pause hidden) by inserting three dots separated by spaces:
## Slide with a pause
content before the pause
. . .
content after the pause
Multiple Columns
To put material in side by side columns, you can use a native div container with class .columns, containing two or more div containers with class .column and a width attribute:
:::: {.columns}
::: {.column width="40%"}
Left column
:::
::: {.column width="60%"}
Right column
:::
::::
Content Overflow
If you have a slide that has more content than can be displayed on a single frame there are two slide-level classes you can apply to mitigate this:
Use the .smaller class to use a smaller typeface so that more text fits on the slide. For example:
## Slide Title {.smaller}
Use the .scrollable class to make off-slide content available by scrolling. For example:
## Slide Title {.scrollable}
Both of these options can also be applied globally to all slides as follows:
---
format:
revealjs:
smaller: true
scrollable: true
---
Speaker Notes
You can add speaker notes to a slide using a div with class .notes. For example:
## Slide with speaker notes
Slide content
::: {.notes}
Speaker notes go here.
:::
Press the S key (or use the Navigation Menu) to show the presentation speaker view:
You’ll typically use this view on one screen (e.g. your laptop) while presenting the slides on another screen.
Themes
There are 11 built-in themes provided for Reveal presentations (you can also create your own themes). The default and dark themes use fairly classic typography and color schemes and are a good place to start.
The default theme is used automatically — use the theme option to switch to an alternate theme. For example
---
title: "Presentation"
format:
revealjs:
theme: dark
---
Here is the full list of available themes:
beige
blood
dark
default
league
moon
night
serif
simple
sky
solarized
See the article on Reveal Themes for additional details on customizing themes and creating brand new themes of your own.
Asides & Footnotes
Asides contain content of more peripheral interest, and are displayed in a smaller, lighter font at the bottom of the slide. Creates asides using a div with the aside class. For example:
## Slide Title
Slide content
::: aside
Some additional commentary of more peripheral interest.
:::
Footnotes have a similar visual treatment to asides, but include a footnote number. For example, here we use a footnote and an aside on a single slide:
## Slide Title
- Green ^[A footnote]
- Brown
- Purple
::: aside
Some additional commentary of more peripheral interest.
:::
Which looks like this when rendered:
If you prefer that footnotes be included at the end of the document, specify the reference-location: document option:
---
format:
revealjs:
reference-location: document
---
Note that when specifying this option footnotes can still be viewed while on the slide by hovering over the footnote number.
Footer & Logo
You can include footer text and a logo at the bottom of each slide using the footer and logo options. For example:
---
format:
revealjs:
logo: logo.png
footer: "Footer text"
---
You can also include a custom footer per-slide by adding a footer div at the bottom of the the slide:
## Slide Title
Slide content
::: footer
Custom footer text
:::
Code Blocks
Most of the core capabilities of Quarto HTML Code Blocks are available for Reveal slides, including code folding, code copy, and the ability to pick a custom syntax highlighting theme. Note that if you choose a dark Reveal theme then the default Quarto dark syntax highlighting theme will be used.
Line Highlighting
You may want to highlight specific lines of code output (or even highlight distinct lines over a progression of steps). You can do this using the code-line-numbers attribute of code blocks. For example:
```{.python code-line-numbers="6-8"}
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Note that you can also highlight disparate ranges of lines by separating them with a comma. For example:
```{.python code-line-numbers="7,9"}
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Finally, you can highlight different line ranges progressively by separating them with |. For example, here we start by showing all lines, then progress to highlighting line 6, and finally to highlighting line 9:
```{.python code-line-numbers="|6|9"}
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
You can use this same option within an executable code cell by using the code-line-numbers cell options:
```{python}
#| code-line-numbers: "|6|9"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Executable Code
You can include the output of executable code blocks on slides just the same as with other Quarto documents. This works essentially the same for slides as it does for other formats, however there are a couple of special considerations for slides covered below.
Figure Size
You will frequently need to customize the size of figures created for slides so that they either fill the entire slide or whatever region of the slide you need them to. Quarto provides some help here: for Python the figure sizes for Matplotlib and Plotly Express are set to fill the slide area below the title, and for R the Knitr figure width and height are similarly defaulted.
Nevertheless, you will frequently need to change these defaults for a given figure. The details on how to do this vary by graphics library. Here’s an example of explicitly sizing an Altair plot:
alt.Chart(cars).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
).properties(
width=700,
height=300
).interactive()
Code Echo
Unlike with ordinary documents, within Quarto presentations executable code blocks do not echo their source code by default (this is because often the code produces a figure that wants to occupy as much vertical space as possible). You can override this behavior using the echo option. For example:
```{python}
#| echo: true
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={"projection": "polar"})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Output Location
By default, output from executable code blocks is displayed immediately after the code. You can use the output-location option to modify this behavior as follows:
fragment
Display output as a Fragment (delay showing it until it is explicitly stepped through by advancing the slide).
slide
Display output on the subsequent slide.
column
Display output in a column adjacent to the code.
column-fragment
Display output in a column adjacent to the code and delay showing it until it is explicitly stepped through by advancing the slide.
For example, here we display cell output on its own slide:
```{r}
#| echo: true
#| output-location: slide
library(ggplot2)
ggplot(airquality, aes(Temp, Ozone)) +
geom_point() +
geom_smooth(method = "loess")
```
See the documentation on Execution Options for more details on the various other ways to customize output from code execution.
Tabsets
You can add tabbed content to slides using the standard Quarto syntax for tabsets. For example:
::: {.panel-tabset}
### Tab A
Content for `Tab A`
### Tab B
Content for `Tab B`
:::
Note that one significant disadvantage to tabsets is that only the first tab will be visible when printing to PDF.
Slide Backgrounds
Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a background attribute to your slide headers. Four different types of backgrounds are supported: color, image, video and iframe.
All CSS color formats are supported, including hex values, keywords, rgba() or hsl(). For example:
## Slide Title {background-color="aquamarine"}
You can also use various types of media (image, video, or iframe) as your slide background. These options are described below.
Note that if the background color of your media differs from your presentation’s theme (e.g. a dark image when using a light theme) then you should also explicitly set the background-color so that text on top of the background appears in the correct color (e.g. light text on a dark background).
Image Backgrounds
By default, background images are resized to cover the full page. Available options:
Attribute
Default
Description
background-image
URL of the image to show. GIFs restart when the slide opens.
background-size
cover
See background-size on MDN.
background-position
center
See background-position on MDN.
background-repeat
no-repeat
See background-repeat on MDN.
background-opacity
1
Opacity of the background image on a 0-1 scale. 0 is transparent and 1 is fully opaque.
For example:
## Slide Title {background-color="black" background-image="https://placekitten.com/100/100" background-size="100px" background-repeat="repeat"}
This slide's background image will be sized to 100px and repeated.
Since this image has a dark background and our slides use the default (light) theme, we explicitly set the background-color to black so that text drawn on top of it is light.
Video Backgrounds
Automatically plays a full size video behind the slide.
Attribute
Default
Description
background-video
A single video source, or a comma separated list of video sources.
background-video-loop
false
Flags if the video should play repeatedly.
background-video-muted
false
Flags if the audio should be muted.
background-size
cover
Use cover for full screen and some cropping or contain for letterboxing.
background-opacity
1
Opacity of the background video on a 0-1 scale. 0 is transparent and 1 is fully opaque.
For example:
## Slide Title {background-video="video.mp4" background-video-loop="true" background-video-muted="true"}
This slides's background video will play in a loop with audio muted.
IFrame Backgrounds
Embeds a web page as a slide background that covers 100% of the reveal.js width and height. The iframe is in the background layer, behind your slides, and as such it’s not possible to interact with it by default. To make your background interactive, you can add the background-interactive attribute.
Attribute
Default
Description
background-iframe
URL of the iframe to load
background-interactive
false
Include this attribute to make it possible to interact with the iframe contents. Enabling this will prevent interaction with the slide content.
For example:
## Slide Title {background-iframe="https://example.com"}
Slide Backgrounds Without a Title
You can always omit the title text, and specify only the slide background information:
## {background-color="aquamarine"}
(A slide with no title)
## {background-color="black" background-image="https://placekitten.com/100/100" background-size="100px" background-repeat="repeat"}
(Another slide with no title)
Main Title Slide Background
The main title slide is the first slide, which is generated via document YAML options. As a result, the methods described above won’t work for providing a background for the title slide. Rather, you need to do the following:
Provide the title slide background options under title-slide-attributes
Prepend the background options with data-
For example:
---
title: My Slide Show
title-slide-attributes:
data-background-image: /path/to/title_image.png
data-background-size: contain
data-background-opacity: "0.5"
---
Learning More
See these articles lo learn about more advanced capabilities of Reveal:
Presenting Slides describes slide navigation, printing to PDF, drawing on slides using a chalkboard, and creating multiplex presentations.
Advanced Reveal delves into transitions, animations, advanced layout and positioning, and other options available for customizing presentations.
Reveal Themes talks about using and customizing existing themes as well as creating brand new themes. | {
"lastmod": "2023-07-05T19:35:15.755Z",
"loc": "https://quarto.org/docs/presentations/revealjs/index.html",
"source": "https://quarto.org/docs/presentations/revealjs/index.html"
} |
Slide Title (without .smaller)
Bullet Point 1
Bullet Point 2
Slide Title (with .smaller)
Bullet Point 1
Bullet Point 2 | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/smaller.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/smaller.html"
} |
Slide 1, incrementally
Eat spaghetti
Drink wine
Slide 2, non-incrementally
Eat spaghetti
Drink wine | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/incremental-lists-2.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/incremental-lists-2.html"
} |
Slide 1, incrementally
Eat spaghetti
Drink wine
Slide 2, non-incrementally
Eat spaghetti
Drink wine | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/incremental-lists-3.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/incremental-lists-3.html"
} |
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={"projection": "polar"})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show() | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/code-echo.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/code-echo.html"
} |
Slide 1
Bullet Point 1
Bullet Point 2
Bullet Point 3
Bullet Point 4
Bullet Point 5
Bullet Point 6
Bullet Point 7
Bullet Point 8
Bullet Point 9
Bullet Point 10
Bullet Point 11
Bullet Point 12
Bullet Point 13
Bullet Point 14
Bullet Point 15
Bullet Point 16
Slide 2
Bullet Point 1
Bullet Point 2
Bullet Point 3
Bullet Point 4
Bullet Point 5
Bullet Point 6
Bullet Point 7
Bullet Point 8
Bullet Point 9
Bullet Point 10
Bullet Point 11
Bullet Point 12
Bullet Point 13
Bullet Point 14
Bullet Point 15
Bullet Point 16 | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/scrollable-and-smaller.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/scrollable-and-smaller.html"
} |
(A slide with no title)
(Another slide with no title) | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/background-no-title.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/background-no-title.html"
} |
Left column
Right column | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/columns.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/columns.html"
} |
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show() | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/line-highlighting-2.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/line-highlighting-2.html"
} |
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show() | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/line-highlighting-1.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/line-highlighting-1.html"
} |
Slide 1
incremental list, 1
incremental list, 2
Slide 2
incremental list, 3
incremental list, 4 | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/incremental-lists-1.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/incremental-lists-1.html"
} |
Habits
John Doe
In the morning
Getting up
Turn off alarm
Get out of bed
Breakfast
Eat eggs
Drink coffee
In the evening
Dinner
Eat spaghetti
Drink wine
Going to sleep
Get in bed
Count sheep | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/creating-slides-2.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/creating-slides-2.html"
} |
Habits
John Doe
Getting up
Turn off alarm
Get out of bed
Going to sleep
Get in bed
Count sheep | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/creating-slides-1.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/creating-slides-1.html"
} |
Title
Tab ATab B
Content for Tab A
Content for Tab B | {
"lastmod": "2023-07-05T19:35:15.743Z",
"loc": "https://quarto.org/docs/presentations/revealjs/examples/tabset.html",
"source": "https://quarto.org/docs/presentations/revealjs/examples/tabset.html"
} |
Title Slide
The main title slide is the first slide of the presentation, and its content is generated based on a variety document options (title, subtitle, date, author, institute, etc.).
Custom Background
If you want to provide a custom background for the title slide, then do the following:
Use the title-slide-attributes key to provide background options.
Within this key, specify any of the supported slide background options, but with data- prepended to them. For example:
For example:
---
title: My Slide Show
title-slide-attributes:
data-background-image: /path/to/title_image.png
data-background-size: contain
data-background-opacity: "0.5"
---
Custom Template
You can replace the default title slide entirely with your own template. To do this, specify a title-slide.html template partial. For example:
title: My Slide Show
format:
revealjs:
template-partials:
- title-slide.html
Here is the source code for the default title slide template partial. Customize this template as required, then save the resutls to title-slide.html alongside your presentation.
Slide Transitions
Reveal supports a number of animated transition effects for both slide changes and slide background changes. By default no transitions are used, however you can enable them either globally or per-slide using the options described below.
Here are the available transition types:
Transition
Description
none
No transition (switch instantly)
fade
Cross fade
slide
Slide horizontally
convex
Slide at a convex angle
concave
Slide at a concave angle
zoom
Scale the incoming slide so it grows in from the center of the screen.
Here’s how you would set the global transition style for both slides and backgrounds:
---
title: "Presentation"
format:
revealjs:
transition: slide
background-transition: fade
---
You can also specify the transition-speed as default, fast, or slow:
---
title: "Presentation"
format:
revealjs:
transition: slide
transition-speed: fast
---
You can also specify the transition and/or transition-speed for an individual slide:
## Slide Title {transition="fade" transition-speed="fast"}
You can also specify separate in and out transitions, for example:
## Slide Title {transition="fade-in slide-out"}
Slide Visibility
You can hide a slide by adding the visibility="hidden" attribute to the slide heading. For example:
## Slide Title {visibility="hidden"}
Uncounted Slides
When preparing a presentation it can sometimes be helpful to prepare optional slides that you may or may not have time to show. This is easily done by appending a few slides at the end of the presentation, however this means that the Reveal progress bar and slide numbering will hint that there are additional slides.
To “hide” those slides from then numbering system you can use visibility="uncounted". For example:
## Slide 1
## Slide 2
## Slide 3 {visibility="uncounted"}
Presentation Size
All presentations have a “normal” size, that is, the resolution at which they are authored. This default “normal” size is 1050 x 700, which is used to match as nearly as possible the aspect ratio of most laptops.
Reveal will automatically scale presentations uniformly based on the normal size to ensure that everything fits on any given display or viewport without changing the aspect ratio or layout of your content.
You can change the slide size, the margin around content, as well as set limits on content scaling using the following options:
Option
Description
width
Normal width (defaults to 1050)
height
Normal height (defaults to 700)
margin
Factor of the display size that should remain empty around the content (defaults to 0.1)
min-scale
Smallest possible scale to apply to content (defaults to 0.2)
max-scale
Largest possible scale to apply to content (defaults to 2.0)
Absolute Position
The absolute class lets you position elements at arbitrary positions on a slide. These elements have CSS position: absolute and can be placed relative to the top, left, bottom, and/or right edges of the slide.
For example, here we add the .absolute class to three images and give them each a distinct position on the slide (note that we use also width and height to control their dimensions):
![](image1.png){.absolute top=200 left=0 width="350" height="300"}
![](image2.png){.absolute top=50 right=50 width="450" height="250"}
![](image3.png){.absolute bottom=0 right=50 width="300" height="300"}
The following attributes can be used with absolute. All of these values can be specified in CSS units (e.g. px, em, etc.). If a number with no units is specified (as in the above example) then pixels are assumed.
Attribute
Description
width
Width of element
height
Height of element
top
Distance from top of slide
left
Distance from left of slide
bottom
Distance from bottom of slide
right
Distance from right of slide
Note that default size of presentation slides is 1050 x 700. See Presentation Size for details on customizing this.
Layout Helpers
Reveal provides some helper classes for controlling the layout of content.
Stack Layout
The r-stack layout class lets you center and place multiple elements on top of each other. This is intended to be used together with fragments to incrementally reveal elements.
For example, here we create a div with the .r-stack class and then include 3 images (each of which uses .fragment so they display incrementally):
::: {.r-stack}
![](image1.png){.fragment width="450" height="300"}
![](image2.png){.fragment width="300" height="450"}
![](image3.png){.fragment width="400" height="400"}
:::
Fit Text
The r-fit-text class makes text as large as possible without overflowing the slide. This is great when you want BIG text without having to manually find the right font size. For example:
::: {.r-fit-text}
Big Text
:::
Stretch
The r-stretch layout helper lets you resize an element, like an image or video, to cover the remaining vertical space in a slide. For example, here the image will automatically be resized to fit space remaining outside of the slide title and text before and after it:
## Slide Title
Here is an image:
![](image.png){.r-stretch}
Some text after the image.
For slides that contain only a single top-level image, the .r-stretch class is automatically applied to the image. You can disable this behavior by setting the auto-stretch: false option:
format:
revealjs:
auto-stretch: false
You can also disable auto-stretch for an individual slide by adding the .nostretch class:
## Slide Title {.nostretch}
auto-stretch will only apply on non-nested image, which means an image in a feature blocks (e.g fragments, layout panel, columns, … ) or a custom Divs will be ignored. For custom Divs, you can opt-in auto-stretch behavior by adding the class .r-stretch to the outer divs. In that the image within the blocks will be unwrapped below.
Auto Animate
Revealjs can automatically animate elements across slides. All you need to do is add the auto-animate attribute to two adjacent slides and Auto-Animate will animate all matching elements between the two.
Here’s a simple example to give you a better idea of how it can be used. Note that the slides don’t have titles in this example (rather just the auto-animate attribute) however they could also include a title.
## {auto-animate=true}
::: {style="margin-top: 100px;"}
Animating content
:::
## {auto-animate=true}
::: {style="margin-top: 200px; font-size: 3em; color: red;"}
Animating content
:::
This example uses the margin-top property to move the element but internally Reveal will use a CSS transform to ensure smooth movement. This same approach to animation works with most animatable CSS properties meaning you can transition things like position, font-size, line-height, color, background-color, padding and margin.
Code Animations
You can also animate between code blocks to show changes in code. For example:
## {auto-animate="true"}
```r
# Fill in the spot we created for a plot
output$phonePlot <- renderPlot({
# Render a barplot
})
```
## {auto-animate=true}
```r
# Fill in the spot we created for a plot
output$phonePlot <- renderPlot({
# Render a barplot
barplot(WorldPhones[,input$region]*1000,
main=input$region,
ylab="Number of Telephones",
xlab="Year")
})
```
Movement Animations
Animations are not limited to changes in style. Auto-Animate can also be used to automatically move elements into their new position as content is added, removed or rearranged on a slide. All without a single line of inline CSS. For example, here the delta between the content on two slides is implicitly animated:
## {auto-animate=true}
Animation
## {auto-animate=true}
Implicit
Animation
Element Matching
When you navigate between two auto-animated slides we’ll do our best to automatically find matching elements in the two slides. For text, we consider it a match if both the text contents and node type are identical. For images, videos and iframes we compare the src attribute. We also take into account the order in which the element appears in the DOM.
In situations where automatic matching is not feasible you can give the objects that you want to animate between a matching data-id attribute. We prioritize matching data-id values above our automatic matching.
Here’s an example where we’ve given several blocks a matching ID since automatic matching has no content to go on. This example also makes use of some additional animation attributes (auto-animate-easing and auto-animate-delay), which we’ll describe the use of in the next section.
## {auto-animate=true auto-animate-easing="ease-in-out"}
::: {.r-hstack}
::: {data-id="box1" auto-animate-delay="0" style="background: #2780e3; width: 200px; height: 150px; margin: 10px;"}
:::
::: {data-id="box2" auto-animate-delay="0.1" style="background: #3fb618; width: 200px; height: 150px; margin: 10px;"}
:::
::: {data-id="box3" auto-animate-delay="0.2" style="background: #e83e8c; width: 200px; height: 150px; margin: 10px;"}
:::
:::
## {auto-animate=true auto-animate-easing="ease-in-out"}
::: {.r-stack}
::: {data-id="box1" style="background: #2780e3; width: 350px; height: 350px; border-radius: 200px;"}
:::
::: {data-id="box2" style="background: #3fb618; width: 250px; height: 250px; border-radius: 200px;"}
:::
::: {data-id="box3" style="background: #e83e8c; width: 150px; height: 150px; border-radius: 200px;"}
:::
:::
Animation Settings
You can override specific animation settings such as easing and duration either for the whole presentation, per-slide or individually for each animated element. The following configuration attributes can be used to change the settings for a specific slide or element:
Attribute
Default
Description
auto-animate-easing
ease
A CSS easing function.
auto-animate-unmatched
true
Determines whether elements with no matching auto-animate target should fade in. Set to false to make them appear instantly.
auto-animate-duration
1.0
Animation duration in seconds.
auto-animate-delay
0
Animation delay in seconds (can only be set for specific elements, not at the slide level).
auto-animate-id
absent
An id tying auto-animate slides together.
auto-animate-restart
absent
Breaks apart two adjacent auto-animate slides (even with the same id).
You can override the global defaults for easing, unmatched, and duration as follows:
---
title: "My Slide"
format:
revealjs:
auto-animate-easing: ease-in-out
auto-animate-unmatched: false
auto-animate-duration: 0.8
---
Fragments
Fragments are used to highlight or incrementally reveal individual elements on a slide. Every element with the class fragment will be stepped through before moving on to the next slide.
Note that fragments as discussed here are a relatively advanced form of incremental content display—see Incremental Lists for documentation on creating incremental bullet lists and inserting content pauses in slides.
The default fragment style is to start out invisible and fade in. This style can be changed by appending a different class to the fragment. For example:
::: {.fragment}
Fade in
:::
::: {.fragment .fade-out}
Fade out
:::
::: {.fragment .highlight-red}
Highlight red
:::
::: {.fragment .fade-in-then-out}
Fade in, then out
:::
::: {.fragment .fade-up}
Slide up while fading in
:::
Fragment Classes
Here are all of the available fragment classes:
Name
Effect
fade-out
Start visible, fade out
fade-up
Slide up while fading in
fade-down
Slide down while fading in
fade-left
Slide left while fading in
fade-right
Slide right while fading in
fade-in-then-out
Fades in, then out on the next step
fade-in-then-semi-out
Fades in, then to 50% on the next step
grow
Scale up
semi-fade-out
Fade out to 50%
shrink
Scale down
strike
Strike through
highlight-red
Turn text red
highlight-green
Turn text green
highlight-blue
Turn text blue
highlight-current-red
Turn text red, then back to original on next step
highlight-current-green
Turn text green, then back to original on next step
highlight-current-blue
Turn text blue, then back to original on next step
Nested Fragments
Multiple fragments can be applied to the same element sequentially by wrapping it, this will fade in the text on the first step, turn it red on the second and partially fade out on the third::
::: {.fragment .fade-in}
::: {.fragment .highlight-red}
::: {.fragment .semi-fade-out}
Fade in > Turn red > Semi fade out
:::
:::
:::
Fragment Order
By default fragments will be stepped through in the order that they appear in the DOM. This display order can be changed using the fragment-index attribute. Note that multiple elements can appear at the same index:
::: {.fragment fragment-index=3}
Appears last
:::
::: {.fragment fragment-index=1}
Appears first
:::
::: {.fragment fragment-index=2}
Appears second
:::
Parallax Background
If you want to use a parallax scrolling background, add the parallax-background-image and parallax-background-size options. For example:
---
title: "Presentation"
format:
revealjs:
parallax-background-image: background.png
parallax-background-size: "2100px 900px"
parallax-background-horizontal: 200
parallax-background-vertical: 50
---
Note that the parallax-background-horizontal and parallax-background-vertical options are not required (the defaults shown above will be used if they are not specified).
Vertical Slides
Reveal uses classic linear slide navigation by default. If you wish you can also configure slide navigation to nest multiple slides within a single top-level slide to create a vertical stack.
Use the navigation-mode option to fine tune Reveal navigation behavior:
Navigation Mode
Behavior
linear
Left/right arrows step through all slides (both horizontal and vertical).
vertical
Left/right arrow keys step between horizontal slides. Up/down arrow keys step between vertical slides. Space key steps through all slides (both horizontal and vertical).
grid
When this is enabled, stepping left/right from a vertical stack to an adjacent vertical stack will land you at the same vertical index.
If you use vertical or grid navigation, you should structure your slides using level 1 headings for the horizontal axis and level 2 headings for the vertical axis. For example:
---
title: "Presentation"
format:
revealjs:
navigation-mode: vertical
---
# Slide 1
## Slide 1.1
## Slide 1.2
# Slide 2
## Slide 2.1
## Slide 2.2
Slide Controls
When you enable vertical or grid navigation, controls will appear to provide a visual cue to where you are in the presentation (e.g. if there are vertical slides below you’ll see a down control).
By default these controls appear at the edges of the presentation, you can position them in the bottom right corner using the controls-layout option. You can also provide an extra visual cue to viewers that the controls are available using the controls-tutorial option. For example:
---
title: "Presentation"
format:
revealjs:
navigation-mode: vertical
controls-layout: bottom-right
controls-tutorial: true
---
Note that using controls-layout: bottom-right isn’t compatible with including a logo (as the logo appears in the bottom right corner as well).
You can also disable the controls entirely with controls: false.
Warning
While vertical slides do provide some additional flexibility over the traditional linear model, they are in practice very confusing for end users (mostly because they are so unexpected). Users will often skip the vertical content because they simply don’t know its there.
If your content benefits from vertical orientation (e.g. you have optional drill-down content that you don’t want in the main flow of the presentation) by all means use the vertical mode. Just know that if you distribute your slides to users they will very likely not end up viewing any of the vertical content.
Touch Navigation
You can swipe to navigate through a presentation on any touch-enabled device. Horizontal swipes change between horizontal slides, vertical swipes change between vertical slides.
If you wish to disable this you can set the touch option to false:
---
title: "Presentation"
format:
revealjs:
touch: false
controls: true
---
Note that we also enable controls at the same time (as users on phones or tablets don’t have access to a keyboard).
Reveal Plugins
To use Revealjs plugins, you need to package them into a directory with a config file (plugin.yml). The config file lets Quarto know how to inject the plugin into the presentation (e.g. what scripts and/or css files to include, what the default configuration should be, etc.).
See the source code of the plugins that are built in to Quarto Reveal for examples:
https://github.com/quarto-dev/quarto-cli/tree/main/src/resources/formats/revealjs/plugins
To use a plugin, just include a reference to its directory in the list of plugins. For example:
---
title: "Presentation"
format:
revealjs:
revealjs-plugins:
- myplugin
---
Note that many of the most popular Reveal plugins are already included with the Quarto version of Reveal, so there is no need to include them separately. Built in plugins include:
Multiplex
RevealMenu
RevealChalkboard
PdfExport
Example
Let’s show an example with the fullscreen. Here are the steps to bundle this plugin to use within your Quarto HTML presentation:
Create a folder with the name you want for the plugin, here we’ll call it fullscreen.
Download the plugin files into the created folder. Here the plugin only have a JS file called plugin.js that you can find on the repo rajgoel/reveal.js-plugins. You can keep the name or rename it, e.g fullscreen.js.
In that folder add a plugin.yml file, as in Quarto Reveal examples.
name is a mandatory field which should be the name of the JS function the JS plugin is defining. Open the JS script you downloaded to look for it.
Other fields are for the resources to be used. In our example, only a JS script so we’ll use script
Our plugin.yml would be:
name: RevealFullscreen
script: [fullscreen.js]
Now add the plugin reference into your document YAML header, using the path of the folder your created:
format:
revealjs:
revealjs-plugins:
- fullscreen
The custom plugin will be loaded in your presentation and you can use it. The plugin fullscreen documentation shows an example of adding a Map fullscreen in a slide by adding an attribute on the section, and using stretch on the content. This would translate to having this slide in the .qmd file:
## {fullscreen=true}
<iframe class="stretch" data-src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d61206.89156051744!2d-151.77366863890407!3d-16.50433878928727!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sde!4v1467468929561"></iframe>
Learning More
See these articles lo learn more about using Reveal:
Reveal Basics covers the basic mechanics of creating presentations.
Presenting Slides describes slide navigation, printing to PDF, drawing on slides using a chalkboard, and creating multiplex presentations.
Reveal Themes talks about using and customizing existing themes as well as creating brand new themes. | {
"lastmod": "2023-07-05T19:35:15.703Z",
"loc": "https://quarto.org/docs/presentations/revealjs/advanced.html",
"source": "https://quarto.org/docs/presentations/revealjs/advanced.html"
} |
Overview
The htmlwidgets package enables you to use JavaScript visualization libraries like Leaflet, Plotly, dygraphs, and threejs directly from R.
If you are using the Knitr engine with Quarto this is a great way to incorporate interactivity without learning JavaScript or requiring a Shiny Server to view your document.
Usage
Including htmlwidgets within a Quarto document is as easy as including an R plot. For example, here is how we embed a Leaflet map:
```{r}
library(leaflet)
leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
```
Warning: package 'leaflet' was built under R version 4.1.2
Layout
You can also use layout options with htmlwidgets. For example, here we provide a custom layout to arrange three dygraph time series plots:
```{r}
#| layout: [[1,1], [1]]
library(dygraphs)
dygraph(fdeaths, "Female Deaths")
dygraph(mdeaths, "Male Deaths")
dygraph(ldeaths, "All Deaths")
```
See the article on Figures for additional documentation on custom layouts.
To learn about available htmlwidgets see the showcase page and the htmlwidget gallery. | {
"lastmod": "2023-07-05T19:35:15.675Z",
"loc": "https://quarto.org/docs/interactive/widgets/htmlwidgets.html",
"source": "https://quarto.org/docs/interactive/widgets/htmlwidgets.html"
} |
Introduction
If you are an R user, you may already be familiar with Shiny, a package that makes it easy to build interactive web apps with R.
When using the Knitr computation engine, Quarto documents can include embedded Shiny components (e.g. a plot with sliders that control its inputs) or even simple Shiny applications that include several components.
This section covers integrating Shiny with Quarto and assumes that you already have basic familiarity with Shiny. To learn more about Shiny please visit https://shiny.rstudio.com.
In order to run the examples below you will need the very latest version of the rmarkdown package (v2.10), which you can install with:
install.packages("rmarkdown")
Hello, Shiny
For example, here’s a document that contains a plot of the “Old Faithful” dataset along with a slider to control the number of bins:
Here’s the source code for this example:
---
title: "Old Faithful"
format: html
server: shiny
---
```{r}
sliderInput("bins", "Number of bins:",
min = 1, max = 50, value = 30)
plotOutput("distPlot")
```
```{r}
#| context: server
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
```
There are two important differences between this document and a normal static document:
The inclusion server: shiny within the document’s options, which instructs Quarto to run a Shiny Server behind the document:
---
title: "Old Faithful"
format: html
server: shiny
---
The inclusion of context: server as an option in the second code chunk, which delineates this R code as running within the Shiny Server (this is the code you would typically put in server.R):
```{r}
#| context: server
```
We’ll cover running and deploying Quarto documents with Shiny components in the article on Running Documents. Before that though, let’s cover a more in-depth example.
Custom Layout
Here’s an example that includes multiple inputs as well as a more application like page layout with a sidebar:
Here’s the source code for this example:
---
title: "Iris K-Means Clustering"
format:
html:
page-layout: custom
server: shiny
---
```{r}
#| panel: sidebar
vars <- setdiff(names(iris), "Species")
selectInput('xcol', 'X Variable', vars)
selectInput('ycol', 'Y Variable', vars, selected = vars[[2]])
numericInput('clusters', 'Cluster count', 3, min = 1, max = 9)
```
```{r}
#| panel: fill
plotOutput('plot1')
```
```{r}
#| context: server
selectedData <- reactive({
iris[, c(input$xcol, input$ycol)]
})
clusters <- reactive({
kmeans(selectedData(), input$clusters)
})
output$plot1 <- renderPlot({
palette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3",
"#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999"))
par(mar = c(5.1, 4.1, 0, 1))
plot(selectedData(),
col = clusters()$cluster,
pch = 20, cex = 3)
points(clusters()$centers, pch = 4, cex = 4, lwd = 4)
})
```
There are a few things worth noting in this example:
The YAML front-matter includes the page-layout: custom option (to indicate we want our content to occupy the entire page rather than being centered with padding).
We add panel: sidebar and panel: fill to the two code chunks that define the user-interface to specify that we want them laid out in special panel containers.
We again use context: server on the last R code chunk to indicate that it contains the Shiny Server code.
Page Layout
Some interactive documents you create will use narrative interspersed with Shiny components and some (like this example) will be full page applications. Some may even by hybrids—for example imagine a sidebar on the left containing inputs that control outputs interspersed with narrative in the main document body.
See the article on Component Layout to learn more about the available tools for managing the layout of interactive documents.
Examples
Here are some deployed examples of Quarto documents that use Shiny:
Example
Source
Description
Old Faithful
Code
Demonstrates incorporating an interactive plot into the main flow of a document.
K-Means
Code
Demonstrates using a more “application-like” page layout (sidebar and main panel)
Diamonds
Code
Demonstrates an alternate way to layout inputs (at the bottom of the page in three columns).
Learning More
To learn more about Shiny interactive documents see the following articles:
Running Documents covers how to run interactive documents both within RStudio and at the command line, as well as how to deploy them to end users.
Execution Contexts goes in depth on when different code blocks (e.g. rendering vs. serving) run as well as how to cache expensive computations for more responsive documents.
External Resources describes how to make sure that Shiny can locate resources (e.g. CSS, JS, images, etc.) that you include in your document.
Component Layout enumerates the various techniques you can use to layout interactive components within your documents.
If you are using both JavaScript and Shiny to create interactive documents, you might also be interested in the article on using Shiny Reactives with OJS. | {
"lastmod": "2023-07-05T19:35:15.675Z",
"loc": "https://quarto.org/docs/interactive/shiny/index.html",
"source": "https://quarto.org/docs/interactive/shiny/index.html"
} |
Overview
There are two types of external resource file that might be referenced from within a Shiny interactive document:
Files referenced from R code (e.g. R scripts, datasets, configuration files, etc.); and
Static assets referenced from the web document (e.g. CSS style-sheets, images, etc.)
Below we’ll describe how each of these resource types are handled within interactive documents.
Code Resources
For files referenced from R code, you can reference anything located within the directory of (or sub-directories of) the main .qmd file. This is no different than with any other .qmd file or even R script.
Similarly, files created by executing R code (e.g. figures generated from code chunks) are automatically located in the document _files directory alongside the HTML output file. No special handling is required for these files.
Asset Resources
Many interactive documents will consist of only the generated HTML and figures located in the _files directory. However, in some cases you may want to add static images, CSS files, or other assets to your document.
In these cases, you need to be sure to locate the files within one of the following specially named sub-directories to ensure they can be located by the Shiny server:
Directory
Description
images/
Image files (e.g. PNG, JPEG, etc.)
css/
CSS stylesheets
js/
JavaScript scripts
www/
Any other files (e.g. downloadable datasets)
The reason that all files within the directory of the main .qmd can’t be referenced from within the web document is that many of these files are application source code and data, which may not be something you want to be downloadable by end users. By restricting the files which can be referenced to the above directories you can control which files are downloadable and which are not. | {
"lastmod": "2023-07-05T19:35:15.675Z",
"loc": "https://quarto.org/docs/interactive/shiny/resources.html",
"source": "https://quarto.org/docs/interactive/shiny/resources.html"
} |
Overview
There are a wide variety of way to make data available to OJS:
Read CSV, JSON, SQLite, and more using the FileAttachments API.
Use the ojs_define() function to make data processed in Python or R available to {ojs} cells.
Make calls to Web APIs for online services and data stores.
We’ll explore all of these techniques below.
File Attachments
Use the FileAttachment function from the standard library to read data from a file. For example, here we read and plot a CSV of NOAA’s Monthly CO2 concentration data from Mauna Loa:
```{ojs}
data = {
const co2data = await FileAttachment("co2_mm.csv")
.csv({ typed: true } );
return co2data.map(d => {
d["decimal date"] = Number(d["decimal date"]);
d.average = Number(d.average);
return d;
});
}
Plot.plot({
marks: [
Plot.line(data,
{ x: "decimal date", y: "average"},
{ stroke: "black" }
)
]
})
```
Note that we specified the typed: true option to the csv() function. When this option is specified d3.autoType is used to automatically detect numbers, dates, etc. and convert them to the correct JavaScript types. This is highly recommend when you know that your data is compatible with automatic type detection.
Here are the methods available for structured data formats:
Method
Description
csv
Comma separated values
tsv
Tab separated values
json
JSON (JavaScript objects)
sqlite
SQLite database client
arrow
Apache Arrow IPC file (uncompressed)
There are also methods to get the raw data as a blob, text, image, or stream.
Note that if you are using the arrow() method the Apache Arrow IPC file (Feather V2 file) should be written uncompressed. For example:
```{r}
arrow::write_feather(
mtcars,
"data.arrow",
compression = "uncompressed"
)
```
```{ojs}
data = FileAttachment("data.arrow").arrow()
```
Python and R
The data you want to use with OJS might not always be available in raw form. Often you’ll need to read and preprocess the raw data using Python or R. You can perform this preprocessing during document render (in an {r} or {python} code cell) and then make it available to {ojs} cells via the ojs_define() function.
Here’s an example. We’ll read the same data into R, do some grouping and summarization, then make it available to OJS using ojs_define:
```{r}
#| output: false
library(readr)
library(dplyr)
co2 = read_csv("co2_mm.csv") %>%
group_by(year) %>%
summarize(max = max(average))
ojs_define(co2data = co2)
```
Note that we could have done the same thing using Python (the ojs_define function is available in any document that uses R or Python).
Now we plot the data using Observable Plot:
```{ojs}
yearlyChart = Plot.plot({
marks: [
Plot.line(transpose(co2data),
{x: "year", y: "max"},
{ stroke: "black" }
)
]}
)
```
See the NOAA C02 example for the full source code.
Transpose
You’ll note one additional twist in the OJS code above: we call the transpose function on our co2data before plotting it. The transpose function is built in to Quarto’s OJS engine, and will convert column-oriented datasets (like the ones used in Python and R) into the row-oriented datasets used by many JavaScript plotting libraries (including Plot).
For example, the following JSON data emitted from R or Python:
{
"year": [1958, 1959, 1960],
"max": [317.51, 318.29, 320.04]
}
Is converted to the following via the call to transpose:
[
{ "year": 1959, "max": 317.51 },
{ "year": 1960, "max": 318.29 },
{ "year": 1960, "max": 320.04 }
]
Check the documentation for whatever plotting library you are using from OJS to see whether a call to transpose is required.
Web APIs
You can use the d3.json() function to read JSON data from web services and data sources. Here we query the GitHub API for data on contributions to the Python pandas package:
```{ojs}
d3 = require('d3')
contributors = await d3.json(
"https://api.github.com/repos/pandas-dev/pandas/stats/contributors"
)
commits = contributors.map(contributor => {
const author = contributor.author;
return {
name: author.login,
title: author.login,
group: author.type,
value: contributor.total
}
})
```
View the data sorted by number of commits:
```{ojs}
Inputs.table(commits, { sort: "value", reverse: true })
```
See the GitHub API example for the full source code. | {
"lastmod": "2023-07-05T19:35:15.483Z",
"loc": "https://quarto.org/docs/interactive/ojs/data-sources.html",
"source": "https://quarto.org/docs/interactive/ojs/data-sources.html"
} |
Overview
Quarto includes native support for Observable JS, a set of enhancements to vanilla JavaScript created by Mike Bostock (also the author of D3). Observable JS is distinguished by its reactive runtime, which is especially well suited for interactive data exploration and analysis.
The creators of Observable JS (Observable, Inc.) run a hosted service at https://observablehq.com/ where you can create and publish notebooks. Additionally, you can use Observable JS (“OJS”) in standalone documents and websites via its core libraries. Quarto uses these libraries along with a compiler that is run at render time to enable the use of OJS within Quarto documents.
OJS works in any Quarto document (plain markdown as well as Jupyter and Knitr documents). Just include your code in an {ojs} executable code block. The rest of this article explains the basics of using OJS with Quarto.
Example
We’ll start with a simple example based on Allison Horst’s Palmer Penguins dataset. Here we look at how penguin body mass varies across both sex and species (use the provided inputs to filter the dataset by bill length and island):
filtered = transpose(data).filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
Let’s take a look at the source code for this example. First we create an {ojs} cell that reads in some data from a CSV file using a FileAttachment:
```{ojs}
data = FileAttachment("palmer-penguins.csv").csv({ typed: true })
```
The example above doesn’t plot all of the data but rather a filtered subset. To create our filter we’ll need some inputs, and we’ll want to be able to use the values of these inputs in our filtering function. To do this, we use the viewof keyword and with some standard Inputs:
```{ojs}
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
```
Now we write the filtering function that will transform the data read from the CSV using the values of bill_length_min and island.
```{ojs}
filtered = data.filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
```
Here we see reactivity in action: we don’t need any special syntax to refer to the dynamic input values, they “just work”, and the filtering code is automatically re-run when the inputs change. This works in much the same way a spreadsheet works when you update a cell and other cells that refer to it are recalculated.
Finally, we’ll plot the filtered data using Observable Plot (an open-source JavaScript library for quick visualization of tabular data):
```{ojs}
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
```
Note that as with our inputs, we refer to the filtered variable with no special syntax—the plotting code will be automatically re-run whenever filtered changes (which in turn is updated whenever an input changes).
That covers a basic end-to-end use of OJS (see the Penguins examples for the full source code).
If you take a look at the Penguins code, you’ll notice something curious: the inputs and plotting code are defined before the data processing code. This demonstrates a critical difference between OJS cell execution and traditional notebooks: cells do not need to be defined in any particular order.
Because execution is fully reactive, the runtime will automatically execute cells in the correct order based on how they reference each other. This is more akin to a spreadsheet than a traditional notebook with linear cell execution.
Libraries
Our example above made use of several standard libraries, including:
Observable stdlib — Core primitives for DOM manipulation, file handling, importing code, and much more.
Observable Inputs — Standard inputs controls including sliders, drop-downs, tables, check-boxes, etc.
Observable Plot — High level plotting library for exploratory data visualization.
The libraries are somewhat special because they are automatically available within notebooks on https://observablehq.com as well as within {ojs} cells in Quarto documents.
Using other JavaScript libraries is also straightforward, they just need to be explicitly imported. For example, here we import a some libraries using the require function (which in turn loads NPM modules from jsDelivr):
```{ojs}
d3 = require("d3@7")
topojson = require("topojson")
```
See the article on Libraries to learn more about using standard and third-party libraries.
Data Sources
In our initial example we used a FileAttachment as our data source. File attachments support many formats including CSV, TSV, JSON, Arrow (uncompressed), and SQLite so are a convenient way to read a dataset that has already been prepared for analysis.
Frequently though you’ll need to do some pre-processing of your data in Python or R before it’s ready for visualization. Within Quarto, you can do this pre-processing during document render then make the results available to OJS.
Use the ojs_define() function from Python or R to define variables that you want to use within JavaScript. For example, to reproduce the simple CSV read in Python you might do this:
```{python}
import pandas as pd
penguins = pd.read_csv("palmer-penguins.csv")
ojs_define(data = penguins)
```
The call to ojs_define(data = penguins) says that we want to make a variable named data (with the value of the penguins data frame) available to OJS
Depending on the visualization library you use, one additional step may be required to consume the data from JavaScript. In this case, the Plot function expects data by row rather than by column, so we transpose() it before filtering:
```{ojs}
filtered = transpose(data).filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
```
See the article on Data Sources to learn more about the various ways to prepare and read data.
OJS Cells
There are many options available to customize the behavior of {ojs} code cells, including showing, hiding, and collapsing code as well as controlling the visibility and layout of outputs.
The most important cell option to be aware of is the echo option, which controls whether source code is displayed. You’ll have different preferences depending on whether you are embedding visualizations in an article or creating a notebook or full-on tutorial.
Code in {ojs} cells is displayed by default. To prevent display of code for an entire document, set the echo: false option in YAML metadata:
---
title: "My Document"
execute:
echo: false
---
You can also specify this option on a per-cell basis. For example:
```{ojs}
//| echo: false
data = FileAttachment("palmer-penguins.csv").csv({ typed: true })
```
To learn about all of the options available, see the article on OJS Cells.
Learning More
These articles go into more depth on using OJS in Quarto documents:
Libraries covers using standard libraries and external JavaScript libraries.
Data Sources outlines the various ways to read and pre-process data.
OJS Cells goes into more depth on cell execution, output, and layout.
Shiny Reactives describes how to integrate Shiny with OJS.
Code Reuse delves into ways to re-use OJS code across multiple documents.
If you want to learn more about the underlying mechanics of reactivity, check out these notebooks from Mike Bostock:
Five Minute Introduction
Observable’s not JavaScript
Introduction to Views
How Observable Runs | {
"lastmod": "2023-07-05T19:35:15.667Z",
"loc": "https://quarto.org/docs/interactive/ojs/index.html",
"source": "https://quarto.org/docs/interactive/ojs/index.html"
} |
Overview
There are three types of library you’ll generally use with OJS:
Observable core libraries automatically available in every document.
Third-party JavaScript libraries from npm and ObservableHQ.
Custom libraries you and/or your colleagues have created
In this document we’ll provide a high-level overview of the core libraries and some examples of using third-party libraries (D3 and Arquero). Creating your own libraries is covered in the article on Code Reuse.
Stdlib
The Observable standard library provides the core capabilities that underlie rendering content and loading code and data. Some particularly important components of the standard library include:
Component
Description
DOM
Dynamically creating DOM elements
FileAttachments
Reading files in a variety of formats
require
Importing third-party modules from NPM and GitHub
You can find complete documentation for the standard library at https://github.com/observablehq/stdlib.
Inputs
The Observable inputs library provides widgets that can be bound to reactive expressions via the viewof keyword. Some particularly useful input include:
Component
Description
Radio
Choose from mutually exclusive set of options
Checkbox
Choose one or more options from a list
Range
Slider for continuous numeric values
Select
Drop down select box
Table
Select one or more rows from a table
You can find complete documentation for all of the inputs at https://github.com/observablehq/inputs.
Plot
Observable Plot is a JavaScript library for exploratory data visualization. Plot is built upon a set of core concepts (Marks, Scales, Transforms, and Facets) that can be composed together to create custom visualizations.
Here’s an example of a histogram of the weight of Olympic athletes created with Plot:
```{ojs}
athletes = FileAttachment("athletes.csv").csv({typed: true})
Plot.plot({
grid: true,
facet: {
data: athletes,
y: "sex"
},
marks: [
Plot.rectY(
athletes,
Plot.binX({y: "count"}, {x: "weight", fill: "sex"})
),
Plot.ruleY([0])
]
})
```
You can find complete documentation for Observable plot https://github.com/observablehq/plot.
D3
D3.js is a JavaScript library for manipulating documents based on data. D3 is capable of creating just about any interactive graphic you can imagine!
Here’s a zoomable sunburst diagram (originally published here) created with D3. Only two layers of the hierarchy are shown at a time. Click a node to zoom in, or the center to zoom out.
sunburst = {
const root = partition(flareData);
root.each(d => d.current = d);
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, width])
.style("font", "15px sans-serif");
const g = svg.append("g")
.attr("transform", `translate(${width / 2},${width / 2})`);
const path = g.append("g")
.selectAll("path")
.data(root.descendants().slice(1))
.join("path")
.attr("fill", d => { while (d.depth > 1) d = d.parent; return color(d.data.name); })
.attr("fill-opacity", d => arcVisible(d.current) ? (d.children ? 0.6 : 0.4) : 0)
.attr("d", d => arc(d.current));
path.filter(d => d.children)
.style("cursor", "pointer")
.on("click", clicked);
path.append("title")
.text(d => `${d.ancestors().map(d => d.data.name).reverse().join("/")}\n${format(d.value)}`);
const label = g.append("g")
.attr("pointer-events", "none")
.attr("text-anchor", "middle")
.style("user-select", "none")
.selectAll("text")
.data(root.descendants().slice(1))
.join("text")
.attr("dy", "0.35em")
.attr("fill-opacity", d => +labelVisible(d.current))
.attr("transform", d => labelTransform(d.current))
.text(d => d.data.name);
const parent = g.append("circle")
.datum(root)
.attr("r", radius)
.attr("fill", "none")
.attr("pointer-events", "all")
.on("click", clicked);
function clicked(event, p) {
parent.datum(p.parent || root);
root.each(d => d.target = {
x0: Math.max(0, Math.min(1, (d.x0 - p.x0) / (p.x1 - p.x0))) * 2 * Math.PI,
x1: Math.max(0, Math.min(1, (d.x1 - p.x0) / (p.x1 - p.x0))) * 2 * Math.PI,
y0: Math.max(0, d.y0 - p.depth),
y1: Math.max(0, d.y1 - p.depth)
});
const t = g.transition().duration(750);
// Transition the data on all arcs, even the ones that aren’t visible,
// so that if this transition is interrupted, entering arcs will start
// the next transition from the desired position.
path.transition(t)
.tween("data", d => {
const i = d3.interpolate(d.current, d.target);
return t => d.current = i(t);
})
.filter(function(d) {
return +this.getAttribute("fill-opacity") || arcVisible(d.target);
})
.attr("fill-opacity", d => arcVisible(d.target) ? (d.children ? 0.6 : 0.4) : 0)
.attrTween("d", d => () => arc(d.current));
label.filter(function(d) {
return +this.getAttribute("fill-opacity") || labelVisible(d.target);
}).transition(t)
.attr("fill-opacity", d => +labelVisible(d.target))
.attrTween("transform", d => () => labelTransform(d.current));
}
function arcVisible(d) {
return d.y1 <= 3 && d.y0 >= 1 && d.x1 > d.x0;
}
function labelVisible(d) {
return d.y1 <= 3 && d.y0 >= 1 && (d.y1 - d.y0) * (d.x1 - d.x0) > 0.03;
}
function labelTransform(d) {
const x = (d.x0 + d.x1) / 2 * 180 / Math.PI;
const y = (d.y0 + d.y1) / 2 * radius;
return `rotate(${x - 90}) translate(${y},0) rotate(${x < 180 ? 0 : 180})`;
}
return svg.node();
}
To use D3 in an {ojs} cell, first import it using the require function (which loads modules hosted at jsDelivr):
```{ojs}
d3 = require("d3@7")
```
Then, use d3 as needed to create your visualization. For example, here are the first few lines of the cell that creates the visualization above:
```{ojs}
sunburst = {
const root = partition(flareData);
root.each(d => d.current = d);
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, width])
.style("font", "15px sans-serif");
// ...remainder of implementation
return svg.node();
}
```
See the Sunburst example for the complete source code. To learn more about D3, visit https://d3js.org/.
Arquero
Arquero is a JavaScript library for query processing and transformation of array-backed data tables. Following the relational algebra and inspired by the design of dplyr, Arquero provides a fluent API for manipulating column-oriented data frames.
Here we’ll import Arquero (aq) and an alias to Arquero operations (op), read a dataset, then filter, aggregate, and view the data:
```{ojs}
import { aq, op } from '@uwdata/arquero'
penguins = aq.loadCSV("palmer-penguins.csv")
penguins
.groupby('species')
.filter(p => p.body_mass_g > 0)
.rollup({
count: op.count(),
avg_mass: op.average('body_mass_g')
})
.view()
```
See the Arquero example for complete source code. To learn more about using Arquero, see the Introducing Arquero tutorial.
Modules
NPM
The require function in the standard library can be used to import npm modules (which are served from the jsDelivr CDN):
```{ojs}
d3 = require("d3")
topojson = require("topojson")
```
Modules can optionally include an @ sign with a version. For example:
```{ojs}
d3 = require("d3@7")
```
See the jsDelivr documentation for additional details. Note that the require function automatically prepends the prefix https://cdn.jsdelivr.net/npm/ when resolving imports, so where the jsDeliver documentation says to use this URL:
https://cdn.jsdelivr.net/npm/package@version/file
You need only pass this to require:
package@version/file
ObservableHQ
Notebooks published on http://observablehq.com can also be compiled and downloaded as JavaScript modules.
While notebooks often have their own embedded dataset, you can actually replace this data with your own when you import them! Returning to the sunburst example from above, here we import a notebook and use the with keyword to provide our own value for data:
```{ojs}
pdata = FileAttachment("population.json").json()
import { chart } with { pdata as data } from "@d3/zoomable-sunburst"
chart
```
One important restriction to be aware of is that not all notebooks published on ObservableHQ have an open-source license. Notebooks need to explicitly tagged with a license as an indication that it’s okay to use them outside of ObservableHQ.
You can see the license for a notebook in its header area. For, example this notebook is tagged with the ISC license:
You should check the license of ObservableHQ notebooks before you import them. See the documentation on notebook licenses for additional details on how to do this.
Appendix
```{ojs}
flareData = FileAttachment("examples/flare-2.json").json()
```
```{ojs}
partition = flareData => {
const root = d3.hierarchy(flareData)
.sum(d => d.value)
.sort((a, b) => b.value - a.value);
return d3.partition()
.size([2 * Math.PI, root.height + 1])
(root);
}
```
```{ojs}
color = d3.scaleOrdinal(d3.quantize(d3.interpolateRainbow, flareData.children.length + 1))
```
```{ojs}
format = d3.format(",d")
```
```{ojs}
width = 932
```
```{ojs}
radius = width / 6
```
```{ojs}
arc = d3.arc()
.startAngle(d => d.x0)
.endAngle(d => d.x1)
.padAngle(d => Math.min((d.x1 - d.x0) / 2, 0.005))
.padRadius(radius * 1.5)
.innerRadius(d => d.y0 * radius)
.outerRadius(d => Math.max(d.y0 * radius, d.y1 * radius - 1))
```
```{ojs}
d3 = require("d3@7")
``` | {
"lastmod": "2023-07-05T19:35:15.667Z",
"loc": "https://quarto.org/docs/interactive/ojs/libraries.html",
"source": "https://quarto.org/docs/interactive/ojs/libraries.html"
} |
A simple example based on Allison Horst’s Palmer Penguins dataset. Here we look at how penguin body mass varies across both sex and species (use the provided inputs to filter the dataset by bill length and island):
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
PlotData
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
Inputs.table(filtered)
data = FileAttachment("palmer-penguins.csv").csv({ typed: true })
filtered = data.filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
Source Code
---
title: "Penguins"
format:
html:
toc: false
echo: false
keep-hidden: true
code-tools: true
---
A simple example based on Allison Horst's [Palmer Penguins](https://allisonhorst.github.io/palmerpenguins/) dataset. Here we look at how penguin body mass varies across both sex and species (use the provided inputs to filter the dataset by bill length and island):
```{ojs}
//| panel: input
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
```
::: {.panel-tabset}
## Plot
```{ojs}
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
```
## Data
```{ojs}
Inputs.table(filtered)
```
:::
```{ojs}
data = FileAttachment("palmer-penguins.csv").csv({ typed: true })
```
```{ojs}
filtered = data.filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
``` | {
"lastmod": "2023-07-05T19:35:15.663Z",
"loc": "https://quarto.org/docs/interactive/ojs/examples/penguins.html",
"source": "https://quarto.org/docs/interactive/ojs/examples/penguins.html"
} |
Read and plot a CSV of NOAA’s Monthly CO2 concentration data from Mauna Loa:
data = {
const co2data = await FileAttachment("co2_mm.csv")
.csv({ typed: true });
return co2data.map(d => {
d["decimal date"] = Number(d["decimal date"]);
d.average = Number(d.average);
return d;
});
}
Plot.plot({
marks: [
Plot.line(data,
{ x: "decimal date", y: "average"},
{ stroke: "black" }
)
]
})
Read the same data into R, do some grouping and summarization, then make it available using ojs_define:
library(readr)
library(dplyr)
co2 = read_csv("co2_mm.csv") %>%
group_by(year) %>%
summarize(max = max(average))
ojs_define(co2data = co2)
Now plot the summarized data:
Plot.plot({
marks: [
Plot.line(transpose(co2data),
{x: "year", y: "max"},
{ stroke: "black" }
)
]}
)
Source Code
---
title: "NOAA CO2"
format:
html:
code-tools: true
---
Read and plot a CSV of NOAA's Monthly [CO2 concentration data](https://gml.noaa.gov/ccgg/trends/data.html) from Mauna Loa:
```{ojs}
data = {
const co2data = await FileAttachment("co2_mm.csv")
.csv({ typed: true });
return co2data.map(d => {
d["decimal date"] = Number(d["decimal date"]);
d.average = Number(d.average);
return d;
});
}
Plot.plot({
marks: [
Plot.line(data,
{ x: "decimal date", y: "average"},
{ stroke: "black" }
)
]
})
```
Read the same data into R, do some grouping and summarization, then make it available using `ojs_define`:
```{r}
#| output: false
#| warning: false
library(readr)
library(dplyr)
co2 = read_csv("co2_mm.csv") %>%
group_by(year) %>%
summarize(max = max(average))
ojs_define(co2data = co2)
```
Now plot the summarized data:
```{ojs}
Plot.plot({
marks: [
Plot.line(transpose(co2data),
{x: "year", y: "max"},
{ stroke: "black" }
)
]}
)
``` | {
"lastmod": "2023-07-05T19:35:15.663Z",
"loc": "https://quarto.org/docs/interactive/ojs/examples/noaa-co2.html",
"source": "https://quarto.org/docs/interactive/ojs/examples/noaa-co2.html"
} |
You can control the layout of OJS content in a number of ways.
page-layout: full
This example uses page-layout: full to have its contents occupy the entire width of the page:
---
title: "Layout"
format:
html:
page-layout: full
---
Enclose the inputs in a sidebar panel and the outputs in a tabset panel (click the “Code” button at top right to see the full source code):
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
PlotData
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
Inputs.table(filtered)
Read and filter the data based on the user’s inputs:
data = FileAttachment("palmer-penguins.csv").csv({typed: true})
filtered = data.filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
width and layoutWidth: fine-grained layout tracking
Like ObservableHQ, ojs cells support the reactive width which tracks the clientWidth of the main HTML element.
width
In addition, if you need the widths of specific parts of the layout, use the CSS class ojs-track-layout in a div. Quarto’s OJS runtime tracks all such divs in layoutWidth. In this example, the tabset above has id penguins-tabset, and you can see its clientWidth reactively below. If this webpage is sufficiently wide, the sidebar will take up some of the space and the width of the resulting tabset will be smaller:
layoutWidth
Source Code
---
title: "Layout"
format:
html:
echo: false
code-tools: true
page-layout: full
toc: false
---
You can control the layout of OJS content in a number of ways.
## `page-layout: full`
This example uses `page-layout: full` to have its contents occupy the entire width of the page:
``` yaml
---
title: "Layout"
format:
html:
page-layout: full
---
```
Enclose the inputs in a sidebar panel and the outputs in a tabset panel (click the "Code" button at top right to see the full source code):
```{ojs}
//| panel: sidebar
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
```
::: {#penguins-tabset .panel-tabset .ojs-track-layout}
## Plot
```{ojs}
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
```
## Data
```{ojs}
Inputs.table(filtered)
```
:::
Read and filter the data based on the user's inputs:
```{ojs}
//| echo: true
data = FileAttachment("palmer-penguins.csv").csv({typed: true})
filtered = data.filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
```
## `width` and `layoutWidth`: fine-grained layout tracking
Like ObservableHQ, `ojs` cells support the reactive `width` which tracks the `clientWidth` of the main HTML element.
```{ojs}
//| echo: true
width
```
In addition, if you need the widths of specific parts of the layout, use the CSS class `ojs-track-layout` in a div. Quarto's OJS runtime tracks all such divs in `layoutWidth`. In this example, the tabset above has id `penguins-tabset`, and you can see its `clientWidth` reactively below. If this webpage is sufficiently wide, the sidebar will take up some of the space and the width of the resulting tabset will be smaller:
```{ojs}
//| echo: true
layoutWidth
``` | {
"lastmod": "2023-07-05T19:35:15.663Z",
"loc": "https://quarto.org/docs/interactive/ojs/examples/layout.html",
"source": "https://quarto.org/docs/interactive/ojs/examples/layout.html"
} |
Overview
Adding interactivity to an article is a great way to help readers explore the concepts and data you are presenting more deeply. There are three ways to add interactive components to Quarto documents:
Create custom JavaScript visualizations using Observable JS.
Use the Shiny R package to add interactivity to Knitr engine documents.
Incorporate Jupyter Widgets or htmlwidgets (for the Jupyter and Knitr engines, respectively) into your document.
Each of these techniques has distinct benefits and drawbacks in terms of expressiveness, ease of development, and deployment requirements. We’ll touch on these considerations briefly below, then provide links to more in depth documentation for learning more.
Observable JS
Quarto includes native support for Observable JS, a set of enhancements to vanilla JavaScript created by Mike Bostock (also the author of D3). Observable JS is distinguished by its reactive runtime, which is especially well suited for interactive data exploration and analysis.
Here’s an example that provides slider inputs to condition the behavior of a visualization:
viewof talentWeight = Inputs.range([-2, 2], { value: 0.7, step: 0.01, label: "talent weight" })
viewof looksWeight = Inputs.range([-2, 2], { value: 0.7, step: 0.01, label: "looks weight" })
viewof minimum = Inputs.range([-2, 2], { value: 1, step: 0.01, label: "minimum fame" })
{
const w = 400
const h = 400;
const result = d3.create("svg").attr("width", w).attr("height", h);
const margin = 20;
const xScale = d3.scaleLinear().domain([-2, 2]).range([margin, w - margin]);
const yScale = d3.scaleLinear().domain([-2, 2]).range([h - margin, margin]);
const points = result
.append("g")
.selectAll("circle")
.data(actors)
.join(enter => {
const sel = enter
.append("circle")
.attr("r", 3)
.attr("cx", d => xScale(d.talent))
.attr("cy", d => yScale(d.looks))
.attr("fill", d3.lab(50, 40, 20));
return sel.filter(d => d.fame <= minimum)
.attr("fill", "rgb(200, 200, 200)")
.attr("r", 2);
});
const linearRegression = regression.regressionLinear()
.x(d => d.talent)
.y(d => d.looks)
.domain([-2, 2]);
const chosenActors = actors
.filter(d => d.fame > minimum);
const line = result
.append("g")
.append("line")
.attr("stroke", d3.lab(20, 40, 20))
.attr("stroke-width", 1.5)
.datum(linearRegression(chosenActors))
.attr("x1", d => xScale(d[0][0]))
.attr("x2", d => xScale(d[1][0]))
.attr("y1", d => yScale(d[0][1]))
.attr("y2", d => yScale(d[1][1]));
const xAxis = d3.axisBottom(xScale).ticks(3);
result.append("g")
.attr("transform", `translate(0, ${yScale(0)})`)
.call(xAxis);
result.append("text")
.attr("x", xScale(0.05))
.attr("y", yScale(2))
.text("Looks");
result.append("text")
.attr("y", yScale(0.1))
.attr("x", xScale(-2))
.text("Talent");
const yAxis = d3.axisLeft(yScale).ticks(3);
result.append("g")
.attr("transform", `translate(${xScale(0)}, 0)`)
.call(yAxis);
return result.node();
}
actors = transpose(points).map(v => ({
talent: v.x,
looks: v.y,
fame: v.x * talentWeight + v.y * looksWeight
}));
transpose = function(df)
{
const keys = Object.keys(df);
return df[keys[0]]
.map((v, i) => Object.fromEntries(keys.map(key => [key, df[key][i] || undefined])))
.filter(v => Object.values(v).every(e => e !== undefined));
}
regression = require('d3-regression@1');
Observable JS uses some special keywords and a custom runtime to make JavaScript reactive. For example, the “minimum fame” slider in the example above was created with the following code:
viewof minimum = Inputs.range([-2, 2], {
value: 1, step: 0.01,
label: "minimum fame"
})
It’s then referenced as a normal JavaScript variable in code that creates the plot:
sel.filter(d => d.fame <= minimum)
As the user interacts with the slider, the minimum value is updated and any code that references it is automatically re-executed.
One benefit of using JavaScript for interactive documents is that all the logic and computation is performed on the client (so no server is required for deployment).
To learn more see the articles on Observable JS.
Shiny
The Shiny package provides a flexible, easy to use framework for creating interactive web applications with R. Quarto in turn includes support for embedding Shiny components and applets into documents created with the Knitr engine.
Here’s a live example of Shiny interactive components along with a brief explanation of the code required to create them:
Shiny comes with a variety of built in input widgets. With minimal syntax it is possible to include widgets like the ones shown on the left in your apps:
# Select type of trend to plot
selectInput(inputId = "type",
label = strong("Trend index"),
choices = unique(trend_data$type),
selected = "Travel")
Displaying outputs is equally hassle-free:
mainPanel(
plotOutput(outputId = "lineplot",
height = "300px"),
)
Build your plots or tables as you normally would in R, and make them reactive with a call to the appropriate render function:
output$lineplot <- renderPlot({
plot(x = selected_trends()$date,
y = selected_trends()$close,
type = "l",
xlab = "Date",
ylab = "Trend index")
})
Shiny makes it very straightforward to create interactive documents using only R. Unlike using JavaScript though, you will need to deploy documents that use Shiny to a server.
To learn more see the articles on Using Shiny with Quarto.
Widgets
Jupyter Widgets and htmlwidgets are great ways to incorporate interactivity into your documents if you don’t know JavaScript and prefer to work exclusively in Python or R. They also run entirely client-side so can be deployed within normal static HTML documents.
For example, the following Python code is all that is required to embed a Leaflet map into a Jupyter engine document:
```{python}
from ipyleaflet import Map, Marker, basemaps, basemap_to_tiles
m = Map(
basemap=basemap_to_tiles(
basemaps.NASAGIBS.ModisTerraTrueColorCR, "2017-04-08"
),
center=(52.204793, 360.121558),
zoom=4
)
m.add_layer(Marker(location=(52.204793, 360.121558)))
m
```
To learn more see these articles on using widgets with Quarto:
Jupyter Widgets (Jupyter engine).
htmlwidgets (Knitr engine).
Layout
Once you’ve gotten familiar with using various interactive components see the article on Component Layout to learn how to:
Group inputs into an input panel.
Present multiple outputs in a tabset panel.
Use a full page layout rather than the default article layout.
Add a sidebar panel for inputs in a full page layout.
Create custom panel layouts to arrange outputs into rows and columns.
Observable JS on the RStudio IDE
Observable JS offers full access to NPM libraries, and these tend to use JS features that require the Electron version of the RStudio IDE daily builds. If you plan on using Observable JS in the RStudio IDE, we recommend the Electron daily builds. | {
"lastmod": "2023-07-05T19:35:15.479Z",
"loc": "https://quarto.org/docs/interactive/index.html",
"source": "https://quarto.org/docs/interactive/index.html"
} |
Step 1
Install Quarto
_ Find your operating system in the table below
Release Notes
Step 2
Choose your tooland get started
VS Code
Jupyter
RStudio
Neovim
Text Editor | {
"lastmod": "2023-07-05T19:35:15.471Z",
"loc": "https://quarto.org/docs/get-started/index.html",
"source": "https://quarto.org/docs/get-started/index.html"
} |
Choose your tool
VS Code
Jupyter
RStudio
Neovim
Editor
Overview
In this tutorial we’ll show you how to use Quarto with Neovim. While we cover the basics here, you will also want to review the article on Using Neovim with Quarto to learn more about installing, using, and customizing Neovim for Quarto.
If you already have Neovim configured to your liking, you may only want to add the quarto-nvim plugin and only refer to this guide for inspiration and seeing the possibilities. But if you are entirely new to Neovim or want to simply try out a configuration already set up for data science with Quarto, you should head over to this kickstarter configuration. This is also what we will be using for this tutorial.
Note
Neovim is a highly customizable editor. So much so that Neovim core member TJ Devries has recently coined the term Personal Development Environments (PDE)1 to separate the concept from Integrated Development Environments (IDEs) such as VS Code and RStudio.
Out of the box neovim is fairly minimal. To work efficiently and get all the nice features, you have to configure it. You have to make it your own. If this approach sounds enticing to you, read on. Welcome to the rabbit hole. 🐰
You can also watch this video for a quick guide to getting started with the kickstarter configuration alongside this write-up.
The Quarto Neovim plugin aims to not reinvent the wheel. Existing plugins in the Neovim ecosystem are leveraged to provide the full experience. Some of the features provided by quarto-nvim and enhanced by plugins found in the kickstarter configuration are:
Preview for Quarto documents.
Syntax highlighting for markdown and embedded languages
Completion for embedded languages (e.g. Python, R, Julia, etc.)
Commands and key-bindings for running cells and selected lines.
Completion for bibliography references, file paths, LaTeX math symbols, emoji.
Optional spellchecking and completion.
Code snippets.
Export of code chunks into standalone scripts.
See the article on Using Neovim with Quarto for all of the details.
Basic Workflow
Quarto .qmd files contain a combination of markdown and executable code cells. Here’s what it might look like in Neovim to edit and preview a .qmd file:
The document on the right is rendered into the HTML version you see on the left. This is the basic model for Quarto publishing—take a source document and render it to a variety of output formats, including HTML, PDF, MS Word, etc.
The tutorials will make use of the matplotlib and plotly Python packages—the commands you can use to install them are given in the table below.
Platform
Commands
Mac/Linux
Terminal
python3 -m pip install jupyter matplotlib plotly
Windows
Terminal
py -m pip install jupyter matplotlib plotly
Note
Note that while this tutorial uses Python, using Julia (via the IJulia kernel) or using R (via the knitr package), are also well supported. See the articles on Using Julia and Using R for additional details.
Render and Preview
We’ll start out by rendering a simple example (hello.qmd) to a couple of formats. If you want to follow along step-by-step in your own environment, create a new file named hello.qmd and copy the following content into it.
---
title: "Quarto Basics"
format:
html:
code-fold: true
jupyter: python3
---
For a demonstration of a line plot on a polar axis, see @fig-polar.
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r);
ax.set_rticks([0.5, 1, 1.5, 2]);
ax.grid(True);
plt.show()
```
To render and preview, execute the QuartoPreview command by pressing : to enter command mode and typing the command (there is autocompletion if you press the tab key). In the kickstarter configuration, there are more shortcuts starting with space q (spacebar followed by q, in normal mode).
How it Works
When you render a .qmd file with Quarto, the executable code blocks are processed by Jupyter, and the resulting combination of code, markdown, and output is converted to plain markdown. Then, this markdown is processed by Pandoc, which creates the finished format.
Authoring
Let’s try making a small change and then re-rendering:
Change the line of code that defines theta as follows:
theta = 4 * np.pi * r
Save the file using either :w in normal mode or ctrl-s 2
The document is rendered, and the browser preview is updated. This is the basic workflow for authoring with Quarto.
Running Cells
You don’t need to fully render documents in order to iterate on code cells. With the provided configuration we can open a terminal of our choosing using the leader key (<space>) followed byc (for code) and then p (for python) or i (for ipython).
If you wait a little in between the key presses a small window pops up at the bottom of your screen to tell you about existing keybindings:
We can navigate between the code and the terminal using ctrl plus vim direction keys and enter commands into the python REPL by going into insert mode in this terminal buffer.
To send code to the python REPL from quarto we navigate to one of our code blocks and press <space><cr> (space bar followed by Enter). The plugin responsible for sending code to various places, vim-slime will prompt us with the question which terminal to send the code to, pre filled with the latest terminal we created.
If you want to use ctrl+Enter to send code just like in RStudio, you are going to have to tell your terminal emulator to send the correct key codes. For example, in the kitty terminal the configuration looks as follows:
map ctrl+shift+enter no_op
map shift+enter send_text all \x1b[13;2u
map ctrl+enter send_text all \x1b[13;5u
This is what the kickstarter configuration has been tested with.
There are few different types of content in hello.qmd, let’s work a bit with each type.
YAML Options
At the top of the file there is a YAML block with document level options.
---
title: "Quarto Basics"
format:
html:
code-fold: true
jupyter: python3
---
Try changing the code-fold option to false:
format:
html:
code-fold: false
Then re-render the document by saving it. You’ll notice that the code is now shown above the plot, where previously it was hidden with a Code button that could be used to show it.
Narrative content is written using markdown. Here we specify a header and a cross-reference to the figure created in the code cell below.
## Polar Axis
For a demonstration of a line plot on a polar axis, see @fig-polar.
Try changing the header and re-rendering—the preview will update with the new header text.
Code Cells
Code cells contain executable code to be run during render, with the output (and optionally the code) included in the rendered document.
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
You are likely familiar with the Matplotlib code given here. However, there are some less familiar components at the top of the code cell: label and fig-cap options. Cell options are written in YAML using a specially prefixed comment (#|).
In this example, the cell options are used to make the figure cross-reference-able. Try changing the fig-cap and/or the code then re-rendering to see the updated preview.
There are a wide variety of cell options that you can apply to tailor your output. We’ll delve into these options in the next tutorial.
Note
One particularly useful cell option for figures is fig-alt, which enables you to add alternative text to images for users with visual impairments. See Amy Cesal’s article on Writing Alt Text for Data Visualization to learn more.
Next Up
You now know the basics of creating and authoring Quarto documents. The following tutorials explore Quarto in more depth:
Tutorial: Computations — Learn how to tailor the behavior and output of executable code blocks.
Tutorial: Authoring — Learn more about output formats and technical writing features like citations, crossrefs, and advanced layout.
See the article on Using Neovim with Quarto to learn more about installing, using, and customizing Neovim for Quarto.
Footnotes
In this video↩︎
if you are using the kickstarter configuration – otherwise ctrl-s puts your terminal in a waiting mode until you press ctrl+q, which can be confusing↩︎ | {
"lastmod": "2023-07-05T19:35:15.467Z",
"loc": "https://quarto.org/docs/get-started/hello/neovim.html",
"source": "https://quarto.org/docs/get-started/hello/neovim.html"
} |
{
"lastmod": "2023-07-05T19:35:15.467Z",
"loc": "https://quarto.org/docs/get-started/hello/index.html",
"source": "https://quarto.org/docs/get-started/hello/index.html"
} |
|
Choose your tool
VS Code
Jupyter
RStudio
Neovim
Editor
Overview
In this tutorial we’ll show you how to use Quarto with VS Code. Before getting started, you should install the Quarto VS Code Extension, which includes many tools that enhance working with Quarto, including:
Integrated render and preview for Quarto documents.
Syntax highlighting for markdown and embedded languages
Completion and diagnostics for YAML options
Completion for embedded languages (e.g. Python, R, Julia, etc.)
Commands and key-bindings for running cells and selected lines.
You can install the Quarto extension from within the Extensions tab in VS Code, from the Extension Marketplace, the Open VSX Registry or directly from a VISX extension file.
Note
This tutorial focuses on editing plain text Quarto .qmd files in VS Code. Depending on your preferences and the task at hand there are two other editing modes available for Quarto documents: the Visual Editor and the Notebook Editor. For the purposes of learning we recommend you work through this tutorial using the VS Code text editor, then after you’ve mastered the basics explore using the other editing modes.
Basic Workflow
Quarto .qmd files contain a combination of markdown and executable code cells. Here’s what it might look like in VS Code to edit and preview a .qmd file:
The document on the left is rendered into the HTML version you see on the right. This is the basic model for Quarto publishing—take a source document and render it to a variety of output formats, including HTML, PDF, MS Word, etc.
The tutorials will make use of the matplotlib and plotly Python packages—the commands you can use to install them are given in the table below.
Platform
Commands
Mac/Linux
Terminal
python3 -m pip install jupyter matplotlib plotly
Windows
Terminal
py -m pip install jupyter matplotlib plotly
Note
Note that while this tutorial uses Python, using Julia (via the IJulia kernel) is also well supported. See the article on Using Julia for additional details.
Render and Preview
We’ll start out by rendering a simple example (hello.qmd) to a couple of formats. If you want to follow along step-by-step in your own environment, create a new file named hello.qmd and copy the following content into it.
---
title: "Quarto Basics"
format:
html:
code-fold: true
jupyter: python3
---
For a demonstration of a line plot on a polar axis, see @fig-polar.
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Note that if you are following along be sure to install the required dependencies if you haven’t already:
Platform
Commands
Mac/Linux
Terminal
python3 -m pip install jupyter matplotlib plotly
Windows
Terminal
py -m pip install jupyter matplotlib plotly
To render and preview, execute the Quarto: Render command. You can alternatively use the Ctrl+Shift+K keyboard shortcut, or the Render button at the top right of the editor:
Note that on the Mac you should use Cmd rather than Ctrl as the prefix for all Quarto keyboard shortcuts.
Additionally, there are commands available to render specific formats. Here is a complete list of the supported render commands:
Quarto: Render
Quarto: Render HTML
Quarto: Render PDF
Quarto: Render DOCX
The Quarto: Render command renders the default format of the currently active document. The other commands render specific formats (regardless of the document’s default format). The Ctrl+Shift+K keyboard shortcut will re-execute the most recently executed render command.
How it Works
When you render a .qmd file with Quarto, the executable code blocks are processed by Jupyter, and the resulting combination of code, markdown, and output is converted to plain markdown. Then, this markdown is processed by Pandoc, which creates the finished format.
Authoring
Let’s try making a small change and then re-rendering:
Change the line of code that defines theta as follows:
theta = 4 * np.pi * r
Re-render the file (using Quarto: Render or the Ctrl+Shift+K shortcut) The document is rendered, and the browser preview is updated.
This is the basic workflow for authoring with Quarto.
You do not need to save the file before rendering (as this happens automatically when you render). If you prefer, you can configure the Quarto extension to render whenever you save a document. See the documentation on Render on Save for additional details.
Running Cells
You don’t need to fully render documents in order to iterate on code cells. You’ll notice that there is a Run Cell button above the code cell. Click that button to execute the cell (output is shown side by side in the Jupyter interactive console):
Execute the current cell with Ctrl+Shift+Enter, the current line(s) with Ctrl+Enter, or previous cells with Ctrl+Alt+P (note that on the Mac you should use Cmd rather than Ctrl as the prefix for all Quarto keyboard shortcuts).
There are few different types of content in hello.qmd, let’s work a bit with each type.
YAML Options
At the top of the file there is a YAML block with document level options.
---
title: "Quarto Basics"
format:
html:
code-fold: true
jupyter: python3
---
Try changing the code-fold option to false:
format:
html:
code-fold: false
Then re-render the document (again, no need to save before rendering). You’ll notice that the code is now shown above the plot, where previously it was hidden with a Code button that could be used to show it.
Markdown
Narrative content is written using markdown. Here we specify a header and a cross-reference to the figure created in the code cell below.
## Polar Axis
For a demonstration of a line plot on a polar axis, see @fig-polar.
Try changing the header and re-rendering—the preview will update with the new header text.
Code Cells
Code cells contain executable code to be run during render, with the output (and optionally the code) included in the rendered document.
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
You are likely familiar with the Matplotlib code given here. However, there are some less familiar components at the top of the code cell: label and fig-cap options. Cell options are written in YAML using a specially prefixed comment (#|).
In this example, the cell options are used to make the figure cross-reference-able. Try changing the fig-cap and/or the code then re-rendering to see the updated preview.
There are a wide variety of cell options that you can apply to tailor your output. We’ll delve into these options in the next tutorial.
Note
One particularly useful cell option for figures is fig-alt, which enables you to add alternative text to images for users with visual impairments. See Amy Cesal’s article on Writing Alt Text for Data Visualization to learn more.
External Preview
In this tutorial we’ve demonstrated previewing rendered output in a pane within VS Code. If you prefer to use an external browser for preview (or have no preview triggered at all by rendering) you can use the Preview Type option to specify an alternate behavior:
Next Up
You now know the basics of creating and authoring Quarto documents. The following tutorials explore Quarto in more depth:
Tutorial: Computations — Learn how to tailor the behavior and output of executable code blocks.
Tutorial: Authoring — Learn more about output formats and technical writing features like citations, crossrefs, and advanced layout.
Additionally, may wish to learn about the other editing modes for Quarto documents available within VS Code:
The Visual Editor for WYSIWYG editing of .qmd documents.
The Notebook Editor for editing .ipynb notebooks. | {
"lastmod": "2023-07-05T19:35:15.467Z",
"loc": "https://quarto.org/docs/get-started/hello/vscode.html",
"source": "https://quarto.org/docs/get-started/hello/vscode.html"
} |
Choose your tool
VS Code
Jupyter
RStudio
Neovim
Editor
Overview
In this tutorial we’ll explore more of Quarto’s authoring features. We’ll cover rendering documents in multiple formats and show you how to add components like table of contents, equations, citations, cross-references, and more.
Output Formats
Quarto supports rendering notebooks to dozens of different output formats. By default, the html format is used, but you can specify an alternate format (or formats) within document options.
Format Options
Let’s create a new file (authoring.qmd) and define various formats for it to be rendered to, adding some options to each of the formats. As a reminder, document options are specified in YAML at the beginning of the source file.
---
title: "Quarto Document"
author: "Norah Jones"
format: pdf
---
We specified pdf as the default output format (if we exclude the format option then it will default to html).
Let’s add some options to control our PDF output.
---
title: "Quarto Document"
author: "Norah Jones"
format:
pdf:
toc: true
number-sections: true
---
Multiple Formats
Some documents you create will have only a single output format, however in many cases it will be desirable to support multiple formats. Let’s add the html and docx formats to our document.
---
title: "Quarto Document"
author: "Norah Jones"
toc: true
number-sections: true
highlight-style: pygments
format:
html:
code-fold: true
html-math-method: katex
pdf:
geometry:
- top=30mm
- left=20mm
docx: default
---
There’s a lot to take in here! Let’s break it down a bit. The first two lines are generic document metadata that aren’t related to output formats at all.
title: "Quarto Document"
author: "Norah Jones"
The next three lines are document format options that apply to all formats. which is why they are specified at the root level.
toc: true
number-sections: true
highlight-style: pygments
Next, we have the format option, where we provide format-specific options.
format:
html:
code-fold: true
html-math-method: katex
pdf:
geometry:
- top=30mm
- left=30mm
docx: default
The html and pdf formats each provide an option or two. For example, for the HTML output we want the user to have control over whether to show or hide the code (code-fold: true) and use katex for math text. For PDF we define some margins. The docx format is a bit different—it specifies docx: default. This means just use all of the default options for the format.
Rendering
The formats specified within document options define what is rendered by default. If we render the document with all the options given above using the following.
Terminal
quarto render authoring.qmd
Then the following files would be created.
authoring.html
authoring.pdf
authoring.docx
We can select one or more formats using the --to option.
Terminal
quarto render authoring.qmd --to docx
quarto render authoring.qmd --to docx,pdf
Note that the target file (in this case authoring.qmd) should always be the very first command line argument.
If needed we can also render formats that aren’t specified within document options.
Terminal
quarto render authoring.qmd --to odt
Since the odt format isn’t included within document options, the default options for the format will be used.
Sections
You can use a table of contents and/or section numbering to make it easier for readers to navigate your document. Do this by adding the toc and/or number-sections options to document options. Note that these options are typically specified at the root level because they are shared across all formats.
---
title: Quarto Basics
author: Norah Jones
date: 'May 22, 2021'
toc: true
number-sections: true
---
## Colors
- Red
- Green
- Blue
## Shapes
- Square
- Circle
- Triangle
## Textures
- Smooth
- Bumpy
- Fuzzy
Here’s what this document looks like when rendered to HTML.
There are lots of options available for controlling how the table of contents and section numbering behave. See the output format documentation (e.g. HTML, PDF, MS Word) for additional details.
Equations
You can use LaTeX equations within markdown.
Einstein's theory of special relatively that expresses the equivalence of mass and energy:
$E = mc^{2}$
This appears as follows when rendered.
Einstein’s theory of special relatively that expresses the equivalence of mass and energy:
\(E = mc^{2}\)
Inline equations are delimited with $…$. To create equations in a new line (display equation) use $$…$$. See the documentation on markdown equations for additional details.
Citations
To cite other works within a Quarto document. First create a bibliography file in a supported format (BibTeX or CSL). Then, link the bibliography to your document using the bibliography YAML metadata option.
Here’s a document that includes a bibliography and single citation.
---
title: Quarto Basics
format: html
bibliography: references.bib
jupyter: python3
---
## Overview
Knuth says always be literate [@knuth1984].
```{python}
1 + 1
```
## References
Note that items within the bibliography are cited using the @citeid syntax.
Knuth says always be literate [@knuth1984].
References will be included at the end of the document, so we include a ## References heading at the bottom of the source file.
Here is what this document looks like when rendered.
The @ citation syntax is very flexible and includes support for prefixes, suffixes, locators, and in-text citations. See the documentation on Citations and Footnotes to learn more.
Cross References
Cross-references make it easier for readers to navigate your document by providing numbered references and hyperlinks to figures, tables, equations, and sections. Cross-reference-able entities generally require a label (unique identifier) and a caption.
This example illustrates cross-referencing various types of entities.
---
title: Quarto Crossrefs
format: html
jupyter: python3
---
## Overview
See @fig-simple in @sec-plot for a demonstration of a simple plot.
See @eq-stddev to better understand standard deviation.
## Plot {#sec-plot}
```{python}
#| label: fig-simple
#| fig-cap: "Simple Plot"
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```
## Equation {#sec-equation}
$$
s = \sqrt{\frac{1}{N-1} \sum_{i=1}^N (x_i - \overline{x})^2}
$$ {#eq-stddev}
We cross-referenced sections, figures, and equations. The table below shows how we expressed each of these.
Entity
Reference
Label / Caption
Section
@sec-plot
ID added to heading:
# Plot {#sec-plot}
Figure
@fig-simple
YAML options in code cell:
#| label: fig-simple
#| fig-cap: "Simple Plot"
Equation
@eq-stddev
At end of display equation:
$$ {#eq-stddev}
And finally, here is what this document looks like when rendered.
See the article on Cross References to learn more, including how to customize caption and reference text (e.g. use “Fig.” rather than “Figure”).
Callouts
Callouts are an excellent way to draw extra attention to certain concepts, or to more clearly indicate that certain content is supplemental or applicable to only some scenarios.
Callouts are markdown divs that have special callout attributes. To create a callout within a markdown cell, type the following in your document.
::: {.callout-note}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
This appears as follows when rendered.
Note
Note that there are five types of callouts, including note, tip, warning, caution, and important.
You can learn more about the different types of callouts and options for their appearance in the Callouts documentation.
Article Layout
The body of Quarto articles have a default width of approximately 700 pixels. This width is chosen to optimize readability. This normally leaves some available space in the document margins and there are a few ways you can take advantage of this space.
In this example, we use the reference-location option to indicate that we would like footnotes to be placed in the right margin.
We also use the column: screen-inset cell option to indicate we would like our figure to occupy the full width of the screen, with a small inset.
---
title: Quarto Layout
format: html
reference-location: margin
jupyter: python3
---
## Placing Colorbars
Colorbars indicate the quantitative extent of image data.
Placing in a figure is non-trivial because room needs to
be made for them. The simplest case is just attaching a
colorbar to each axes:^[See the [Matplotlib Gallery](https://matplotlib.org/stable/gallery/subplots_axes_and_figures/colorbar_placement.html) to explore colorbars further].
```{python}
#| code-fold: true
#| column: screen-inset
import matplotlib.pyplot as plt
import numpy as np
fig, axs = plt.subplots(2, 2)
fig.set_size_inches(20, 8)
cmaps = ['RdBu_r', 'viridis']
for col in range(2):
for row in range(2):
ax = axs[row, col]
pcm = ax.pcolormesh(
np.random.random((20, 20)) * (col + 1),
cmap=cmaps[col]
)
fig.colorbar(pcm, ax=ax)
plt.show()
```
Here is what this document looks like when rendered.
You can locate citations, footnotes, and asides in the margin. You can also define custom column spans for figures, tables, or other content. See the documentation on Article Layout for additional details.
Learning More
You’ve now learned the basics of using Quarto! Once you feel comfortable creating and customizing documents here are a few more things to explore:
Presentations — Author PowerPoint, Beamer, and Revealjs presentations using the same syntax you’ve learned for creating documents.
Websites — Publish collections of documents as a website. Websites support multiple forms of navigation and full-text search.
Blogs — Create a blog with an about page, flexible post listings, categories, RSS feeds, and over twenty themes.
Books — Create books and manuscripts in print (PDF, MS Word) and online (HTML, ePub) formats.
Interactivity — Include interactive components to help readers explore the concepts and data you are presenting more deeply.
See the article on Using Neovim with Quarto to learn more about installing, using, and customizing Neovim for Quarto. | {
"lastmod": "2023-07-05T19:35:15.387Z",
"loc": "https://quarto.org/docs/get-started/authoring/neovim.html",
"source": "https://quarto.org/docs/get-started/authoring/neovim.html"
} |
{
"lastmod": "2023-07-05T19:35:15.387Z",
"loc": "https://quarto.org/docs/get-started/authoring/index.html",
"source": "https://quarto.org/docs/get-started/authoring/index.html"
} |
|
Choose your tool
VS Code
Jupyter
RStudio
Neovim
Editor
Overview
In this tutorial we’ll explore more of Quarto’s authoring features. We’ll cover rendering documents in multiple formats and show you how to add components like table of contents, equations, citations, cross-references, and more.
Output Formats
Quarto supports rendering notebooks to dozens of different output formats. By default, the html format is used, but you can specify an alternate format (or formats) within document options.
Format Options
Let’s create a new file (authoring.qmd) and define various formats for it to be rendered to, adding some options to each of the formats. As a reminder, document options are specified in YAML at the beginning of the source file.
---
title: "Quarto Document"
author: "Norah Jones"
format: pdf
---
We specified pdf as the default output format (if we exclude the format option then it will default to html).
Let’s add some options to control our PDF output.
---
title: "Quarto Document"
author: "Norah Jones"
format:
pdf:
toc: true
number-sections: true
---
Multiple Formats
Some documents you create will have only a single output format, however in many cases it will be desirable to support multiple formats. Let’s add the html and docx formats to our document.
---
title: "Quarto Document"
author: "Norah Jones"
toc: true
number-sections: true
highlight-style: pygments
format:
html:
code-fold: true
html-math-method: katex
pdf:
geometry:
- top=30mm
- left=20mm
docx: default
---
There’s a lot to take in here! Let’s break it down a bit. The first two lines are generic document metadata that aren’t related to output formats at all.
title: "Quarto Document"
author: "Norah Jones"
The next three lines are document format options that apply to all formats. which is why they are specified at the root level.
toc: true
number-sections: true
highlight-style: pygments
Next, we have the format option, where we provide format-specific options.
format:
html:
code-fold: true
html-math-method: katex
pdf:
geometry:
- top=30mm
- left=30mm
docx: default
The html and pdf formats each provide an option or two. For example, for the HTML output we want the user to have control over whether to show or hide the code (code-fold: true) and use katex for math text. For PDF we define some margins. The docx format is a bit different—it specifies docx: default. This means just use all of the default options for the format.
Rendering
The formats specified within document options define what is rendered by default. If we render the document with all the options given above using the following.
Terminal
quarto render authoring.qmd
Then the following files would be created.
authoring.html
authoring.pdf
authoring.docx
We can select one or more formats using the --to option.
Terminal
quarto render authoring.qmd --to docx
quarto render authoring.qmd --to docx,pdf
Note that the target file (in this case authoring.qmd) should always be the very first command line argument.
If needed we can also render formats that aren’t specified within document options.
Terminal
quarto render authoring.qmd --to odt
Since the odt format isn’t included within document options, the default options for the format will be used.
Sections
You can use a table of contents and/or section numbering to make it easier for readers to navigate your document. Do this by adding the toc and/or number-sections options to document options. Note that these options are typically specified at the root level because they are shared across all formats.
---
title: Quarto Basics
author: Norah Jones
date: 'May 22, 2021'
toc: true
number-sections: true
---
## Colors
- Red
- Green
- Blue
## Shapes
- Square
- Circle
- Triangle
## Textures
- Smooth
- Bumpy
- Fuzzy
Here’s what this document looks like when rendered to HTML.
There are lots of options available for controlling how the table of contents and section numbering behave. See the output format documentation (e.g. HTML, PDF, MS Word) for additional details.
Equations
You can use LaTeX equations within markdown.
Einstein's theory of special relatively that expresses the equivalence of mass and energy:
$E = mc^{2}$
This appears as follows when rendered.
Einstein’s theory of special relatively that expresses the equivalence of mass and energy:
\(E = mc^{2}\)
Inline equations are delimited with $…$. To create equations in a new line (display equation) use $$…$$. See the documentation on markdown equations for additional details.
Citations
To cite other works within a Quarto document. First create a bibliography file in a supported format (BibTeX or CSL). Then, link the bibliography to your document using the bibliography YAML metadata option.
Here’s a document that includes a bibliography and single citation.
---
title: Quarto Basics
format: html
bibliography: references.bib
jupyter: python3
---
## Overview
Knuth says always be literate [@knuth1984].
```{python}
1 + 1
```
## References
Note that items within the bibliography are cited using the @citeid syntax.
Knuth says always be literate [@knuth1984].
References will be included at the end of the document, so we include a ## References heading at the bottom of the source file.
Here is what this document looks like when rendered.
The @ citation syntax is very flexible and includes support for prefixes, suffixes, locators, and in-text citations. See the documentation on Citations and Footnotes to learn more.
Cross References
Cross-references make it easier for readers to navigate your document by providing numbered references and hyperlinks to figures, tables, equations, and sections. Cross-reference-able entities generally require a label (unique identifier) and a caption.
This example illustrates cross-referencing various types of entities.
---
title: Quarto Crossrefs
format: html
jupyter: python3
---
## Overview
See @fig-simple in @sec-plot for a demonstration of a simple plot.
See @eq-stddev to better understand standard deviation.
## Plot {#sec-plot}
```{python}
#| label: fig-simple
#| fig-cap: "Simple Plot"
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```
## Equation {#sec-equation}
$$
s = \sqrt{\frac{1}{N-1} \sum_{i=1}^N (x_i - \overline{x})^2}
$$ {#eq-stddev}
We cross-referenced sections, figures, and equations. The table below shows how we expressed each of these.
Entity
Reference
Label / Caption
Section
@sec-plot
ID added to heading:
# Plot {#sec-plot}
Figure
@fig-simple
YAML options in code cell:
#| label: fig-simple
#| fig-cap: "Simple Plot"
Equation
@eq-stddev
At end of display equation:
$$ {#eq-stddev}
And finally, here is what this document looks like when rendered.
See the article on Cross References to learn more, including how to customize caption and reference text (e.g. use “Fig.” rather than “Figure”).
Callouts
Callouts are an excellent way to draw extra attention to certain concepts, or to more clearly indicate that certain content is supplemental or applicable to only some scenarios.
Callouts are markdown divs that have special callout attributes. To create a callout within a markdown cell, type the following in your document.
::: {.callout-note}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
This appears as follows when rendered.
Note
Note that there are five types of callouts, including note, tip, warning, caution, and important.
You can learn more about the different types of callouts and options for their appearance in the Callouts documentation.
Article Layout
The body of Quarto articles have a default width of approximately 700 pixels. This width is chosen to optimize readability. This normally leaves some available space in the document margins and there are a few ways you can take advantage of this space.
In this example, we use the reference-location option to indicate that we would like footnotes to be placed in the right margin.
We also use the column: screen-inset cell option to indicate we would like our figure to occupy the full width of the screen, with a small inset.
---
title: Quarto Layout
format: html
reference-location: margin
jupyter: python3
---
## Placing Colorbars
Colorbars indicate the quantitative extent of image data.
Placing in a figure is non-trivial because room needs to
be made for them. The simplest case is just attaching a
colorbar to each axes:^[See the [Matplotlib Gallery](https://matplotlib.org/stable/gallery/subplots_axes_and_figures/colorbar_placement.html) to explore colorbars further].
```{python}
#| code-fold: true
#| column: screen-inset
import matplotlib.pyplot as plt
import numpy as np
fig, axs = plt.subplots(2, 2)
fig.set_size_inches(20, 8)
cmaps = ['RdBu_r', 'viridis']
for col in range(2):
for row in range(2):
ax = axs[row, col]
pcm = ax.pcolormesh(
np.random.random((20, 20)) * (col + 1),
cmap=cmaps[col]
)
fig.colorbar(pcm, ax=ax)
plt.show()
```
Here is what this document looks like when rendered.
You can locate citations, footnotes, and asides in the margin. You can also define custom column spans for figures, tables, or other content. See the documentation on Article Layout for additional details.
Learning More
You’ve now learned the basics of using Quarto! Once you feel comfortable creating and customizing documents here are a few more things to explore:
Presentations — Author PowerPoint, Beamer, and Revealjs presentations using the same syntax you’ve learned for creating documents.
Websites — Publish collections of documents as a website. Websites support multiple forms of navigation and full-text search.
Blogs — Create a blog with an about page, flexible post listings, categories, RSS feeds, and over twenty themes.
Books — Create books and manuscripts in print (PDF, MS Word) and online (HTML, ePub) formats.
Interactivity — Include interactive components to help readers explore the concepts and data you are presenting more deeply.
Additionally, if you are interested in seeing how to use Quarto from within .ipynb notebooks, check out the documentation on using the VS Code Notebook Editor with Quarto. | {
"lastmod": "2023-07-05T19:35:15.387Z",
"loc": "https://quarto.org/docs/get-started/authoring/vscode.html",
"source": "https://quarto.org/docs/get-started/authoring/vscode.html"
} |
Choose your tool
VS Code
Jupyter
RStudio
Neovim
Editor
Overview
Quarto has a wide variety of options available for controlling how code and computational output appear within rendered documents. In this tutorial we’ll take a .qmd file that has some numeric output and plots, and cover how to apply these options.
This tutorial will make use of the matplotlib and plotly Python packages. The commands you can use to install them are given in the table below.
Platform
Commands
Mac/Linux
Terminal
python3 -m pip install jupyter matplotlib plotly pandas
Windows
Terminal
py -m pip install jupyter matplotlib plotly pandas
If you want to follow along step-by-step in your own environment, create a computations.qmd file and copy the following content into it.
---
title: Quarto Computations
jupyter: python3
---
## NumPy
```{python}
import numpy as np
a = np.arange(15).reshape(3, 5)
a
```
## Matplotlib
```{python}
import matplotlib.pyplot as plt
fig = plt.figure()
x = np.arange(10)
y = 2.5 * np.sin(x / 20 * np.pi)
yerr = np.linspace(0.05, 0.2, 10)
plt.errorbar(x, y + 3, yerr=yerr, label='both limits (default)')
plt.errorbar(x, y + 2, yerr=yerr, uplims=True, label='uplims=True')
plt.errorbar(x, y + 1, yerr=yerr, uplims=True, lolims=True,
label='uplims=True, lolims=True')
upperlimits = [True, False] * 5
lowerlimits = [False, True] * 5
plt.errorbar(x, y, yerr=yerr, uplims=upperlimits, lolims=lowerlimits,
label='subsets of uplims and lolims')
plt.legend(loc='lower right')
plt.show(fig)
```
## Plotly
```{python}
import plotly.express as px
import plotly.io as pio
gapminder = px.data.gapminder()
gapminder2007 = gapminder.query("year == 2007")
fig = px.scatter(gapminder2007,
x="gdpPercap", y="lifeExp", color="continent",
size="pop", size_max=60,
hover_name="country")
fig.show()
```
Now, open a Terminal and run quarto preview, then position your editor side-by-side with the browser showing the preview.
Terminal
quarto preview computations.qmd
Cell Output
All of the code in the source file is displayed within the rendered document. However, in some cases, you may want to hide all of the code and just show the output. Let’s go ahead and specify echo: false within the document execute options to prevent code from being printed.
---
title: Quarto Computations
execute:
echo: false
jupyter: python3
---
Save the file after making this change. The preview will update to show the output with no code.
You might want to selectively enable code echo for some cells. To do this add the echo: true cell option. Try this with the NumPy cell.
```{python}
#| echo: true
import numpy as np
a = np.arange(15).reshape(3, 5)
a
```
Save the file and note that the code is now included for the NumPy cell.
There a large number of other options available for cell output, for example warning to show/hide warnings (which can be especially helpful for package loading messages), include as a catch all for preventing any output (code or results) from being included in output, and error to prevent errors in code execution from halting the rendering of the document (and print the error in the rendered document).
See the Jupyter Cell Options documentation for additional details.
Code Folding
Rather than hiding code entirely, you might want to fold it and allow readers to view it at their discretion. You can do this via the code-fold option. Remove the echo option we previously added and add the code-fold HTML format option.
---
title: Quarto Computations
format:
html:
code-fold: true
jupyter: python3
---
Save the file. Now a “Code” widget is available above the output of each cell.
You can also provide global control over code folding. Try adding code-tools: true to the HTML format options.
---
title: Quarto Computations
format:
html:
code-fold: true
code-tools: true
jupyter: python3
---
Save the file and you’ll see that a code menu appears at the top right of the document that provides global control over showing and hiding code.
Figures
Let’s improve the appearance of our Matplotlib output. It could certainly stand to be wider, and it would be nice to provide a caption and a label for cross-referencing.
Go ahead and modify the Matplotlib cell to include label and fig-cap options as well as a call to fig.set_size_inches() to set a larger figure size with a wider aspect ratio:
```{python}
#| label: fig-limits
#| fig-cap: "Errorbar limit selector"
import matplotlib.pyplot as plt
fig = plt.figure()
fig.set_size_inches(12, 7)
```
Save the file to re-render and see the updated plot:
Multiple Figures
The Plotly cell visualizes GDP and life expectancy data from a single year (2007). Let’s plot another year next to it for comparison and add a caption and subcaptions. Since this will produce a wider visualization we’ll also use the column option to lay it out across the entire page rather than being constrained to the body text column.
There are quite a few changes to this cell. Copy and paste this code into computations.qmd if you want to try them locally:
#| label: fig-gapminder
#| fig-cap: "Life Expectancy and GDP"
#| fig-subcap:
#| - "Gapminder: 1957"
#| - "Gapminder: 2007"
#| layout-ncol: 2
#| column: page
import plotly.express as px
import plotly.io as pio
gapminder = px.data.gapminder()
def gapminder_plot(year):
gapminderYear = gapminder.query("year == " +
str(year))
fig = px.scatter(gapminderYear,
x="gdpPercap", y="lifeExp",
size="pop", size_max=60,
hover_name="country")
fig.show()
gapminder_plot(1957)
gapminder_plot(2007)
Save the file, the preview will update as follows:
Let’s discuss some of the new options used here. You’ve seen fig-cap before but we’ve now added a fig-subcap option:
#| fig-cap: "Life Expectancy and GDP"
#| fig-subcap:
#| - "Gapminder: 1957"
#| - "Gapminder: 2007"
For code cells with multiple outputs adding the fig-subcap option enables us to treat them as subfigures.
We also added an option to control how multiple figures are laid out—in this case we specified side-by-side in two columns:
#| layout-ncol: 2
If you have 3, 4, or more figures in a panel there are many options available for customizing their layout. See the article Figures for details.
Finally, we added an option to control the span of the page that our figures occupy:
#| column: page
This allows our figure display to span out beyond the normal body text column. See the documentation on Article Layout to learn about all of the available layout options.
Next Up
You’ve now covered the basics of customizing the behavior and output of executable code in Quarto documents.
Next, check out the the Authoring Tutorial to learn more about output formats and technical writing features like citations, crossrefs, and advanced layout. | {
"lastmod": "2023-07-05T19:35:15.431Z",
"loc": "https://quarto.org/docs/get-started/computations/neovim.html",
"source": "https://quarto.org/docs/get-started/computations/neovim.html"
} |
{
"lastmod": "2023-07-05T19:35:15.431Z",
"loc": "https://quarto.org/docs/get-started/computations/index.html",
"source": "https://quarto.org/docs/get-started/computations/index.html"
} |
|
Choose your tool
VS Code
Jupyter
RStudio
Neovim
Editor
Overview
Quarto has a wide variety of options available for controlling how code and computational output appear within rendered documents. In this tutorial we’ll take a .qmd file that has some numeric output and plots, and cover how to apply these options.
This tutorial will make use of the matplotlib and plotly Python packages. The commands you can use to install them are given in the table below.
Platform
Commands
Mac/Linux
Terminal
python3 -m pip install jupyter matplotlib plotly
Windows
Terminal
py -m pip install jupyter matplotlib plotly
If you want to follow along step-by-step in your own environment, create a computations.qmd file and copy the following content into it.
---
title: Quarto Computations
jupyter: python3
---
## NumPy
```{python}
import numpy as np
a = np.arange(15).reshape(3, 5)
a
```
## Matplotlib
```{python}
import matplotlib.pyplot as plt
fig = plt.figure()
x = np.arange(10)
y = 2.5 * np.sin(x / 20 * np.pi)
yerr = np.linspace(0.05, 0.2, 10)
plt.errorbar(x, y + 3, yerr=yerr, label='both limits (default)')
plt.errorbar(x, y + 2, yerr=yerr, uplims=True, label='uplims=True')
plt.errorbar(x, y + 1, yerr=yerr, uplims=True, lolims=True,
label='uplims=True, lolims=True')
upperlimits = [True, False] * 5
lowerlimits = [False, True] * 5
plt.errorbar(x, y, yerr=yerr, uplims=upperlimits, lolims=lowerlimits,
label='subsets of uplims and lolims')
plt.legend(loc='lower right')
plt.show(fig)
```
## Plotly
```{python}
import plotly.express as px
import plotly.io as pio
gapminder = px.data.gapminder()
gapminder2007 = gapminder.query("year == 2007")
fig = px.scatter(gapminder2007,
x="gdpPercap", y="lifeExp", color="continent",
size="pop", size_max=60,
hover_name="country")
fig.show()
```
Then, execute the Quarto: Render command. You can alternatively use the Ctrl+Shift+K keyboard shortcut, or the Render button at the top right of the editor:
Note that on the Mac you should use Cmd rather than Ctrl as the prefix for all Quarto keyboard shortcuts.
Here is what you should see within VS Code:
Cell Execution
As you author a document you may want to execute one or more cells without re-rendering the entire document. You can do this using the Run Cell button above the code cell. Click that button to execute the cell (output is shown side by side in the Jupyter interactive console):
There are a variety of commands and keyboard shortcuts available for executing cells:
Quarto Command
Keyboard Shortcut
Run Current Cell
⇧⌘ Enter
Run Selected Line(s)
⌘ Enter
Run Next Cell
⌥⌘ N
Run Previous Cell
⌥⌘ P
Run All Cells
⌥⌘ R
Run Cells Above
⇧⌥⌘ P
Run Cells Below
⇧⌥⌘ N
Cell Output
All of the code in the source file is displayed within the rendered document. However, in some cases, you may want to hide all of the code and just show the output. Let’s go ahead and specify echo: false within the document execute options to prevent code from being printed.
---
title: Quarto Computations
execute:
echo: false
jupyter: python3
---
Re-render the document and the preview will update to show the output with no code (remember that you do not need to save the file before rendering, as this happens automatically when you render).
You might want to selectively enable code echo for some cells. To do this add the echo: true cell option. Try this with the NumPy cell.
```{python}
#| echo: true
import numpy as np
a = np.arange(15).reshape(3, 5)
a
```
Re-render note that the code is now included for the NumPy cell.
There a large number of other options available for cell output, for example warning to show/hide warnings (which can be especially helpful for package loading messages), include as a catch all for preventing any output (code or results) from being included in output, and error to prevent errors in code execution from halting the rendering of the document (and print the error in the rendered document).
See the Jupyter Cell Options documentation for additional details.
Code Folding
Rather than hiding code entirely, you might want to fold it and allow readers to view it at their discretion. You can do this via the code-fold option. Remove the echo option we previously added and add the code-fold HTML format option.
---
title: Quarto Computations
format:
html:
code-fold: true
jupyter: python3
---
Render the document. Now a “Code” widget is available above the output of each cell.
You can also provide global control over code folding. Try adding code-tools: true to the HTML format options.
---
title: Quarto Computations
format:
html:
code-fold: true
code-tools: true
jupyter: python3
---
Render the document and you’ll see that a code menu appears at the top right of the document that provides global control over showing and hiding code.
Figures
Let’s improve the appearance of our Matplotlib output. It could certainly stand to be wider, and it would be nice to provide a caption and a label for cross-referencing.
Go ahead and modify the Matplotlib cell to include label and fig-cap options as well as a call to fig.set_size_inches() to set a larger figure size with a wider aspect ratio:
```{python}
#| label: fig-limits
#| fig-cap: "Errorbar limit selector"
import matplotlib.pyplot as plt
fig = plt.figure()
fig.set_size_inches(12, 7)
```
After re-rendering the document you’ll see the updated plot:
Multiple Figures
The Plotly cell visualizes GDP and life expectancy data from a single year (2007). Let’s plot another year next to it for comparison and add a caption and subcaptions. Since this will produce a wider visualization we’ll also use the column option to lay it out across the entire page rather than being constrained to the body text column.
There are quite a few changes to this cell. Copy and paste this code into computations.qmd if you want to try them locally:
#| label: fig-gapminder
#| fig-cap: "Life Expectancy and GDP"
#| fig-subcap:
#| - "Gapminder: 1957"
#| - "Gapminder: 2007"
#| layout-ncol: 2
#| column: page
import plotly.express as px
import plotly.io as pio
gapminder = px.data.gapminder()
def gapminder_plot(year):
gapminderYear = gapminder.query("year == " +
str(year))
fig = px.scatter(gapminderYear,
x="gdpPercap", y="lifeExp",
size="pop", size_max=60,
hover_name="country")
fig.show()
gapminder_plot(1957)
gapminder_plot(2007)
Render the document and the preview will update as follows:
Let’s discuss some of the new options used here. You’ve seen fig-cap before but we’ve now added a fig-subcap option:
#| fig-cap: "Life Expectancy and GDP"
#| fig-subcap:
#| - "Gapminder: 1957"
#| - "Gapminder: 2007"
For code cells with multiple outputs adding the fig-subcap option enables us to treat them as subfigures.
We also added an option to control how multiple figures are laid out—in this case we specified side-by-side in two columns:
#| layout-ncol: 2
If you have 3, 4, or more figures in a panel there are many options available for customizing their layout. See the article Figures for details.
Finally, we added an option to control the span of the page that our figures occupy:
#| column: page
This allows our figure display to span out beyond the normal body text column. See the documentation on Article Layout to learn about all of the available layout options.
Next Up
You’ve now covered the basics of customizing the behavior and output of executable code in Quarto documents.
Next, check out the the Authoring Tutorial to learn more about output formats and technical writing features like citations, crossrefs, and advanced layout. | {
"lastmod": "2023-07-05T19:35:15.431Z",
"loc": "https://quarto.org/docs/get-started/computations/vscode.html",
"source": "https://quarto.org/docs/get-started/computations/vscode.html"
} |
Overview
If the base features of Pandoc and Quarto don’t do exactly what you need, you can very likely create a Pandoc Filter that bridges the gap.
Pandoc consists of a set of readers and writers. When converting a document from one format to another, text is parsed by a reader into pandoc’s intermediate representation of the document—an “abstract syntax tree” or AST—which is then converted by the writer into the target format. The pandoc AST format is defined in the module Text.Pandoc.Definition in the pandoc-types package.
A “filter” is a program that modifies the AST, between the reader and the writer.
INPUT --reader--> AST --filter--> AST --writer--> OUTPUT
Pandoc’s built-in citation processing is implemented as a filter, as are many of Quarto’s internal extensions (e.g. cross-references, figure layout, etc.).
You can write Pandoc filters using Lua (via Pandoc’s built-in Lua interpreter) or using any other language using a JSON representation of the Pandoc AST piped to/from an external process. We strongly recommend using Lua Filters, which have the following advantages:
No external dependencies
High performance (no serialization or process execution overhead)
Access to the Pandoc and Quarto libraries of Lua helper functions.
Activating Filters
If you’ve developed a filter and want to use it within a document you need to add it to the list of filters for the document. For example, here we arrange for the spellcheck filter to run:
---
filters:
- spellcheck.lua
---
By default, user filters are run after Quarto’s built-in filters. For some filters you’ll want to modify this behavior. For example, here we arrange to run spellcheck before Quarto’s filters and lightbox after:
filters:
- spellcheck.lua
- quarto
- lightbox
You’ll notice that one of the extensions (spellcheck.lua) has a file extension and the other (lightbox) does not. This difference stems from how the extensions are distributed: an extension distributed as a plain Lua file uses .lua whereas a filter distributed as a Quarto Extension does not. The next section explores how to create filters as extensions.
Filter Extensions
Quick Start
Here we’ll describe how to create a simple filter extension. We’ll use the quarto create command to do this. If you are using VS Code or RStudio you should execute quarto create within their respective integrated Terminal panes.
To get started, execute quarto create extension filter within the parent directory where you’d like the filter extension to be created:
Terminal
$ quarto create extension filter
? Extension Name › fancy-header
As shown above, you’ll be prompted for an extension name. Type fancy-header and press Enter—the filter extension is then created:
Creating extension at /Users/jjallaire/quarto/dev/fancy-header:
- Created README.md
- Created _extensions/fancy-header/_extension.yml
- Created _extensions/fancy-header/fancy-header.lua
- Created .gitignore
- Created example.qmd
If you are running within VS Code or RStudio a new window will open with the extension project.
Here’s what the contents of the files in _extensions/fancy-header/ look like:
_extensions/fancy-header/_extension.yml
title: Fancy-header
author: J.J. Allaire
version: 1.0.0
quarto-required: ">=99.9.0"
contributes:
filters:
- fancy-header.lua
_extensions/fancy-header/fancy-header.lua
-- Reformat all heading text
function Header(el)
el.content = pandoc.Emph(el.content)
return el
end
Finally, the example.qmd file includes code that exercises the extension. For example:
example.qmd
---
title: "Fancy-header Example"
filters:
- fancy-header
---
## Heading
This filter adds formatting to heading text.
To develop your filter, render/preview example.qmd, and then make changes to fancy-header.lua (the preview will automatically refresh when you change fancy-header.lua).
Development
To learn more about developing filter extensions:
If necessary, brush up on Lua Development (Lua is the language used to create filters).
Review the Pandoc documentation on Writing Lua Filters.
Read the Lua API Reference, which describes the Lua extension API for Quarto.
If you want to write a JSON filter, see the documentation on Writing JSON filters.
To create a new filter extension, use the quarto create extension filter command as described above.
Distribution
if your extension source code it located within a GitHub repository, then it can be added to a project by referencing the GitHub organization and repository name. For example:
Terminal
# target the current HEAD of the extension
quarto add cooltools/output-folding
# target a branch or tagged release of the extension
quarto add cooltools/[email protected]
quarto add cooltools/output-folding@bugfix-22
Note that it is possible to bundle and distribute extensions as simple gzip archives (as opposed to using a GitHub repository as described above). See the article on Distributing Extensions for additional details.
Examples
You might also find it instructive to examine the source code of these filter extensions authored by the Quarto team:
Extension name
Description
latex-environment
Quarto extension to output custom LaTeX environments.
lightbox
Create lightbox treatments for images in your HTML documents. | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/filters.html",
"source": "https://quarto.org/docs/extensions/filters.html"
} |
Installation
If you want to use an extension within a document or project you need to add it to a project or directory. Rather than installing into a global library, Quarto extensions are stored locally, directly alongside the document or project they are used within. For example, if you have a project in a directory named myblog, you could add some extensions for use with that the project as follows:
Terminal
cd myblog
quarto add quarto-ext/fontawesome
quarto add quarto-ext/video
This will result in an _extensions folder being created at the root of your project, and the fontawesome and video extensions being placed within it.
Note that a project isn’t strictly required for using extensions—if you add extensions in a directory that isn’t a project then any document located directly alongside the _extensions folder can use the extensions.
Extension Trust
Quarto extensions may execute code when documents are rendered. Therefore, if you do not trust the author of an extension, we recommend that you do not install or use the extension.
Version Control
If you are using version control you should check the _extensions directory in to your repo along with your other code. Extensions used by a document or project are treated as source code to ensure very long term reproducibility—your project doesn’t need to rely on the availability of an external package manager (or the maintenance of older extension versions) to successfully render now and far into the future.
Repositories
The extensions in the example above were prefixed with quarto-ext because they were distributed from the quarto-ext GitHub organization. Extensions can be similarly distributed from any GitHub organization. So for example the following might also be valid command to add extensions to a project:
Terminal
quarto add cooltools/lightbox
quarto add bigstateu/fancytweet
While it’s convenient to distribute extensions using GitHub, you can also distribute them as an ordinary gzip archive using a URL or a local file. See the article on Distributing Extensions for additional details.
Updating
You can list and update configured extensions for a given project with the following commands:
Terminal
quarto list extensions
quarto update quarto-ext/fontawesome
Note that when updating an extension you’ll be prompted to confirm the update based on the version you have and the version you are attempting to update to.
Removing
Use this command to remove an extension from a project:
Terminal
quarto remove quarto-ext/fontawesome
If you run the quarto remove extension command with no extension-id, you will be presented with a list of extensions that are present and you may select which extensions to remove. | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/managing.html",
"source": "https://quarto.org/docs/extensions/managing.html"
} |
Overview
Quarto extensions are directories that contain an _extensions sub-directory with one or more extensions. The files above the _extensions directory are not installed, so typically contain README and LICENSE files, examples, test cases, etc.
There are two distinct ways to distribute extensions to end users:
Publish your extension in a public GitHub repository.
Bundle your extension into a .zip or .tar.gz archive.
Each method has benefits and drawbacks that will be explored below. First we’ll cover the basic file structure and contents of an extension.
Extension Contents
Quarto Extensions are directories that contain an _extensions folder that contains one or more extension contributions. While the most common case is the distribution of a single extension, it is possible to create a single extension directory that includes multiple shortcodes, multiple filters, or a combination of both.
Here is the contents of an extension named my-filter:
README.md
LICENSE
example.qmd
_extensions/
my-filter/
_extension.yml
my-filter.lua
Note that the only thing strictly required is the _extensions directory (anything above that is for your own purposes and is ignored during installation). Even so, it’s good practice to include a README.md and LICENSE file, and the example.qmd will be useful for developing your extension.
_extension.yml
Each extension is defined by its _extension.yml file which contains the metadata about the extension as well as the what items it contributes when used. For example, here is the _extension.yml for a filter extension:
title: My Filter
author: Cooltools
version: 1.0.0
quarto-required: ">=1.2.0"
contributes:
filters:
- my-filter.lua
Here are all of the fields that can be specified in the _extension.yml file:
title
The extension’s name
author
The author of the extension
version
A semantic version number this release. When installing, updating, or releasing an extension, this version number will be used to present a summary of actions to the user.
quarto-required
A semantic version number indicating the minimum quarto version required to run this extension.
contributes
The items that this extension will contribute to the render. These are allowed subkeys:
shortcodes
A list of shortcode files that should be loaded when this extension is installed.
filters
A list of filters that should be loaded when this extension is included in the list of filters used to render a document or project. The order of the filters in this list will be preserved.
formats
A record containing the key value pairs of output formats and the metadata associated with that output format.
GitHub Distribution
Distributing extensions on GitHub has a number of benefits, including compact syntax (e.g. quarto add org-name/extension), the use of organizations as a “namespace” for managing name conflicts, and the ability to target specific releases or tags.
For example, the extensions in the quarto-ext GitHub organization can be added to a project with these commands:
Terminal
quarto add quarto-ext/lightbox
quarto add quarto-ext/fontawesome
By default, extensions are added from the HEAD of the main branch of the repository. You can also target tags and/or branches in your repository by including an @ after the repository name. For example:
Terminal
quarto add quarto-ext/[email protected]
quarto add quarto-ext/lightbox@bugfix-22
Extensions added from GitHub have another special property: the GitHub organization can be used as a namespace qualifier to disambiguate extensions that have the same name. For example, if you have two different lightbox extensions in your project, you explicitly specify the quarto-ext one as follows:
---
filters:
- quarto-ext/lightbox
---
You can also add an extension from a subdirectory of a GitHub repository. For example, here we install two different extensions from the cooltools/icons repository:
Terminal
quarto add cooltools/icons/fontawesome
quarto add cooltools/icons/iconify
Archive Distribution
Distributing extensions as a .zip or .tar.gz archive has the benefit of not requiring public distribution. These extensions can also be added directly from non-GitHub version control services using the archive URLs normally provided for repositories.
Note that unlike GitHub hosted extensions, extensions installed from archives do not have an organizational namespace (they all share a single namespace).
Git Repositories
To add an extension to a project from a GitLab repository you could do this:
Terminal
quarto add https://gitlab.com/cooltools/shorty/-/archive/main/shorty-main.zip
You’ll note that the above URL references the main branch. You can similarly target any other branch, tag, or release. For example, to add an extension using the v1.0 tag:
Terminal
quarto add https://gitlab.com/cooltools/shorty/-/archive/v1.0/shorty-main.zip
If you are using BitBucket, Azure DevOps, or another Git hosting provider, consult the appropriate service documentation to learn how to form archive URLs for repositories.
Archive Files
The above examples demonstrate adding an extension from a Git repository, you can also add an extension from an archive published to an ordinary web host. For example:
Terminal
quarto add https://cooltools.org/quarto/shorty.zip
Or alternatively from a local archive file or even ordinary uncompressed directory:
Terminal
quarto add ~/Downloads/shorty.zip
quarto add /share/quarto/extensions/shorty | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/distributing.html",
"source": "https://quarto.org/docs/extensions/distributing.html"
} |
Extensions are a powerful way to modify and extend the behavior of Quarto. Below is a listing of available extensions (please let us know if you have an extension you’d like to see added to the list).
See the articles on Creating Extensions to learn how to develop your own extensions.
Shortcode/Filter
Journal Articles
Custom Formats
Revealjs
Shortcodes and Filters
Name
Description
Author
lightbox
Create lightbox treatments for images in your HTML documents.
quarto-ext
molstar
Shortcode to embed proteins and trajectories with Mol*.
jmbuhr
shinylive
This extension lets you embed Shinylive applications in a Quarto document.
quarto-ext
include-code-files
Filter to include code from source files.
quarto-ext
webr
Embed WebR in HTML documents to enable interactive R code cells without the need for an R server.
James Joseph Balamuta
critic-markup
Handle critic markup syntax for tracking changes.
Mathias Louboutin
abstract-section
Write an article abstract in a normal section, not the YAML metadata.
pandoc-ext
social-share
Add buttons to share articles on various social media platforms.
schochastics
social-embeds
Embed content from across the web into HTML documents using a shortcode.
sellorm
fontawesome
Use Font Awesome icons in HTML and PDF documents.
quarto-ext
academicons
Use Academicons in HTML documents
schochastics
bsicons
Use Bootstrap Icons in HTML documents and Revealjs presentations.
Shafayet Khan Shafee
iconify
Use Iconify icons in HTML documents.
Mickaël CANOUIL
lordicon
Use Lordicon icons in HTML documents.
jmgirard
section-biblios
Filter that generates a bibliography for each top-level section / chapter.
pandoc-ext
latex-environment
Output divs as custom LaTeX environments.
quarto-ext
fancy-text
Output nicely formatted versions of fancy strings such as LaTeX and BibTeX in multiple formats.
quarto-ext
animate
Shortcode for animating text using Animate.css.
Mickaël CANOUIL
qrcode
Shortcode to embed QR codes using qrcodejs.
jmbuhr
elevator
Shortcode for using Elevator.js in HTML documents.
Mickaël CANOUIL
nutshell
Embed Nutshell expandable explanations in HTML documents.
schochastics
code-visibility
Directives for filtering code and stream output included within a document.
jjallaire
collapse-callout
Filter that provides global options to make the Callout Blocks collapsible in HTML documents
Shafayet Khan Shafee
forms
Embed flexible HTML forms in documents.
Jonathan Graves
code-insertion
Add markdown/html code immediately before and/or after a post.
Ziyue Li
gfm-strip-disallowed
Remove raw HTML blocks (such as ‘<style>’) that are disallowed by GFM.
restlessronin
line-highlight
Filter to enable source code and output line highlighting for HTML documents (format: html) similar as how code-line-numbers works for RevealJs.
Shafayet Khan Shafee
authors-block
Add author-related header block when rendering docx-documents.
Lorenz A. Kapsner, Albert Krewinkel, Robert Winkler
collapse-social-embeds
Filter to create collapsible callouts with social-embeds for HTML format.
Shafayet Khan Shafee
nameref
Filter that allows to refer a section/image/table using a name for both pdf and HTML format.
Shafayet Khan Shafee
downloadthis
Shortcode that allows to implement a download button with embedded small text/csv/image files for html format.
Shafayet Khan Shafee
lua-env
A filter/shortcode extension for Quarto to provide access to LUA objects as metadata.
Mickaël CANOUIL
add-code-files
Filter to add code from source files as a code block that works with code-fold.
Shafayet Khan Shafee
code-fullscreen
Filter that adds a fullscreen button in the code blocks in revealjs slides and html documents.
Shafayet Khan Shafee
hide-comment
Filter that provides comment-directive to hide comment from code chunk in the rendered document (works for html/revealjs/pdf format).
Shafayet Khan Shafee
pseudocode
A Quarto filter extension to render pseudocode for html and pdf format.
范叶亮 | Leo Van
material-icons
Use Material Design Icons in HTML documents and Revealjs presentations.
Shafayet Khan Shafee
first-line-indent
Smart first-line indent for HTML/LaTeX/PDF outputs
Dialoa/Julien Dutant
reveal-header
Add header text and header logo in all pages of RevealJs slide
Shafayet Khan Shafee
black-formatter
Format the codes in python code-chunk using black formatter.
Shafayet Khan Shafee
recursive-citeproc
Handle self-citing bibliographies.
Dialoa/Julien Dutant
search-replace
Automatically search and replace strings in quarto documents upon rendering
Ute Hahn
interactive-sql
A Quarto filter to run SQL queries interactively from a SQLite database created at render time in html documents and Revealjs presentations.
Shafayet Khan Shafee
docx-horizontal-rule
A simple tool to edit the format of a horizontal rule in .docx output
Matt Capaldi
No matching items | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/listing-filters.html",
"source": "https://quarto.org/docs/extensions/listing-filters.html"
} |
Overview
The programming language used to create filters and shortcodes is Lua, a lightweight, high-level scripting language. Lua is the extension language for Pandoc (which includes an embedded Lua interpreter). This means that Quarto extensions have no additional runtime dependencies or requirements.
This article will start by providing an orientation to learning Lua for those new to the language. Then, we’ll provide some tips for productive Lua development.
See the Lua API Reference for additional details on the APIs available for developing extensions.
Learning Lua
Lua is a scripting language similar to Python, R, Julia, and JavaScript. If you are familiar with one or more of those languages you won’t have trouble picking up Lua.
Here is a recommended approach for learning Lua for use with Quarto:
Read Learn Lua in 15 Minutes for a quick overview of the language and its syntax.
Check out the first two sections of the Pandoc Lua Filters documentation then skip ahead to the Filter Examples section to make things a bit more concrete.
Once you have the basic idea of Lua and filters, get a more complete picture by skimming the full Pandoc Lua Filters documentation. You won’t understand everything, but its a good orientation to all of the moving parts.
Finally, check out the source code of the extensions published in the Quarto Extensions GitHub organization (these are extensions maintained by the Quarto core team). Once you are able to read and understand that code you are ready to start developing your own extensions!
Some additional learning resources you might find useful include:
Lua Quick Reference, a PDF with a compact summary of the language and base library.
Programming in Lua, a book by Roberto Ierusalimschy, the chief architect of the language.
Lua Reference Manual, a complete definition of the language and base library.
Development Tools
Quarto Preview
Quarto preview, quarto preview, is aware of Lua source files within extensions, and will automatically reload the preview whenever a Lua source file changes.
This makes it very easy to incrementally develop and debug Lua code (especially when combined with the native format a described below). Live reloading for Lua files will work no matter what source code editor you are using (VS Code, RStudio, Neovim, etc.).
VS Code
While you can use any text editor along with quarto preview for developing Lua extensions, we strongly recommend that you consider using VS Code, as it provides a number of additional tools including:
Code completion and type checking.
Diagnostics for various common problems with code.
The ability to add types to your own functions.
Code completion covers the Lua base library as well as the Pandoc and Quarto Lua APIs, and also provides documentation on hover:
Diagnostics check for many common errors including failing to check for nil, undefined global values, shadowing of local variables, unused functions, etc.
Installation
To get started with using VS Code for Lua extension development, install the following software:
Install the latest version (v1.2 or greater) of Quarto
Install the latest version (v1.40.0 or greater) of the Quarto VS Code Extension.
For Lua code intelligence, install the Lua LSP VS Code Extension.
Once you’ve installed these components you should see the features described above appear automatically in your Quarto workspaces that include Lua code.
There are many options available for configuring Lua completion and diagnostics. It’s also possible to provide type information for your own functions. See the section on Lua in VS Code below for details.
Diagnostic Logging
Use the functions in the quarto.log module to add diagnostic logging to your extension. You can use both temporary logging calls to debug a particular problem as well as add logging calls that are always present but only activated when the --trace flag is passed to quarto render or quarto preview.
The quarto.log module is based on the pandoc-lua-logging project from @wlupton. You’ll recognize the functions described below from that module (e.g. logging.output(), logging.warning(), etc). For documentation on using all of the logging functions see the project README file.
quarto.log.output
To log any object (including Pandoc AST elements), you the quarto.log.output() function. For example, here we log the Div passed to us in our filter callback function as well as some diagnostic text:
filter.lua
function Header(el)
quarto.log.output("=== Handling Header ===")
quarto.log.output(el)
end
This is log output you’d see in the terminal when the filter is executed:
=== Handling Header ===
Header {
attr: Attr {
attributes: AttributeList {}
classes: List {}
identifier: "section-one"
}
content: Inlines {
[1] Str "Section"
[2] Space
[3] Str "One"
}
level: 2
}
quarto.log.warning
Use the quarto.log.warning() function to output warnings that can be suppressed with the --quiet flag:
filter.lua
function RawBlock(el)
if el.format == "html" then
quarto.log.warning("Raw HTML not supported")
return pandoc.Null()
end
end
For example, the warning above will not appear for this call to quarto render:
quarto render document.qmd --quiet
quarto.log.debug
Use the quarto.log.debug() function to write output whenever the --trace flag is present:
filter.lua
function Header(el)
quarto.log.debug("Header: " .. el.identifier)
end
For example, the debug message will appear for this call to quarto preview:
quarto preview document.qmd --trace
You can keep these calls in your filter since they won’t produce output unless --trace is specified.
Native Format
A great tool for understanding the behavior of a Lua filter or shortcode in more depth is to target the native format (as opposed to html, pdf, etc.). The native format will show you the raw contents of the Pandoc AST. For example, here’s a simple markdown document alongside it’s native output:
document.qmd
---
format: native
---
## Heading
Some text below
Pandoc
Meta
{ unMeta = fromList [] }
[ Header
2
( "heading" , [] , [] )
[ Str "Heading" ]
, Para
[ Str "Some"
, Space
, Str "text"
, Space
, Str "below"
]
]
Here we add a simple filter to the document that wraps all headers in pandoc.Emph (italics). You can see that the Emph AST element now wraps the heading text in the native output:
document.qmd
---
format: native
filters: [filter.lua]
---
## Heading
Some text below
filter.lua
function Header(el)
el.content = {
pandoc.Emph(el.content)
}
return el
end
Pandoc
Meta
{ unMeta = fromList [] }
[ Header
2
( “heading” , [] , [] )
[ Emph [ Str “Heading” ]
]
, Para
[ Str “Some”
, Space
, Str “text”
, Space
, Str “below”
]
]
Lua in VS Code
Type Hints
While Quarto provides type information for the Pandoc and Quarto Lua APIs, this doesn’t cover functions that you write within your own extensions. You can however add type information using Annotations. For example, here we indicate that a function takes a string and a pandoc.List() and returns either a pandoc.List() or nil:
---@param text string
---@param blocks pandoc.List
---@return pandoc.List|nil
function check_for_text(text, blocks)
-- implementation
end
With these type declarations, any attempt to call the function without the correct types will result in a diagnostic message. Further, if a caller fails to check for nil before using the return value a diagnostic will also occur.
You can learn more about all of the available type annotations in the Annotations Reference for the Lua Language Server.
Settings
The Lua Language Server extension includes a wide variety of options to customize its behavior (e.g. what diagnostics to show, which completions to offer, etc.).
All of the available options are documented in the Settings Reference for the Lua Language Server.
Quarto provides a default configuration file (.luarc.json) within the root of any workspace that includes Quarto Lua extensions. This file is necessary because it provides a reference to the Lua type definitions for Pandoc and Quarto within your currently installed version of Quarto. Without it, the Lua extension wouldn’t know anything about Quarto and would report errors for “unknown” Pandoc modules.
If, for example, Quarto is installed at /opt/quarto/, the default contents of the configuration file will be:
.luarc.json
{
"Generator": ["Quarto"],
"Lua.runtime.version": "Lua 5.3",
"Lua.workspace.checkThirdParty": false,
"Lua.workspace.library": ["/opt/quarto/share/lua-types"],
"Lua.runtime.plugin": "/opt/quarto/share/lua-plugin/plugin.lua",
"Lua.completion.showWord": "Disable",
"Lua.completion.keywordSnippet": "Both",
"Lua.diagnostics.disable": ["lowercase-global", "trailing-space"]
}
The .luarc.json file will also be automatically added to .gitignore since it points to the absolute path of Quarto on the local system.
You can change any of the settings within this file save for the Lua.workspace.library and Lua.runtime.plugin (these are automatically maintained by the Quarto extension based on where Quarto is installed). See the Settings Reference for all available settings.
If you prefer to mange this file manually, simply remove the Generator key and Quarto will no longer update the Lua.workspace.library and Lua.runtime.plugin settings automatically.
You can also globally disable the automatic creation of .luarc.json using the Quarto > Lua: Provide Types VS Code setting. | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/lua.html",
"source": "https://quarto.org/docs/extensions/lua.html"
} |
Extensions are a powerful way to modify and extend the behavior of Quarto. Below is a listing of available extensions (please let us know if you have an extension you’d like to see added to the list).
See the articles on Creating Extensions to learn how to develop your own extensions.
Shortcode/Filter
Journal Articles
Custom Formats
Revealjs
Shortcodes and Filters
Name
Description
Author
lightbox
Create lightbox treatments for images in your HTML documents.
quarto-ext
molstar
Shortcode to embed proteins and trajectories with Mol*.
jmbuhr
shinylive
This extension lets you embed Shinylive applications in a Quarto document.
quarto-ext
include-code-files
Filter to include code from source files.
quarto-ext
webr
Embed WebR in HTML documents to enable interactive R code cells without the need for an R server.
James Joseph Balamuta
critic-markup
Handle critic markup syntax for tracking changes.
Mathias Louboutin
abstract-section
Write an article abstract in a normal section, not the YAML metadata.
pandoc-ext
social-share
Add buttons to share articles on various social media platforms.
schochastics
social-embeds
Embed content from across the web into HTML documents using a shortcode.
sellorm
fontawesome
Use Font Awesome icons in HTML and PDF documents.
quarto-ext
academicons
Use Academicons in HTML documents
schochastics
bsicons
Use Bootstrap Icons in HTML documents and Revealjs presentations.
Shafayet Khan Shafee
iconify
Use Iconify icons in HTML documents.
Mickaël CANOUIL
lordicon
Use Lordicon icons in HTML documents.
jmgirard
section-biblios
Filter that generates a bibliography for each top-level section / chapter.
pandoc-ext
latex-environment
Output divs as custom LaTeX environments.
quarto-ext
fancy-text
Output nicely formatted versions of fancy strings such as LaTeX and BibTeX in multiple formats.
quarto-ext
animate
Shortcode for animating text using Animate.css.
Mickaël CANOUIL
qrcode
Shortcode to embed QR codes using qrcodejs.
jmbuhr
elevator
Shortcode for using Elevator.js in HTML documents.
Mickaël CANOUIL
nutshell
Embed Nutshell expandable explanations in HTML documents.
schochastics
code-visibility
Directives for filtering code and stream output included within a document.
jjallaire
collapse-callout
Filter that provides global options to make the Callout Blocks collapsible in HTML documents
Shafayet Khan Shafee
forms
Embed flexible HTML forms in documents.
Jonathan Graves
code-insertion
Add markdown/html code immediately before and/or after a post.
Ziyue Li
gfm-strip-disallowed
Remove raw HTML blocks (such as ‘<style>’) that are disallowed by GFM.
restlessronin
line-highlight
Filter to enable source code and output line highlighting for HTML documents (format: html) similar as how code-line-numbers works for RevealJs.
Shafayet Khan Shafee
authors-block
Add author-related header block when rendering docx-documents.
Lorenz A. Kapsner, Albert Krewinkel, Robert Winkler
collapse-social-embeds
Filter to create collapsible callouts with social-embeds for HTML format.
Shafayet Khan Shafee
nameref
Filter that allows to refer a section/image/table using a name for both pdf and HTML format.
Shafayet Khan Shafee
downloadthis
Shortcode that allows to implement a download button with embedded small text/csv/image files for html format.
Shafayet Khan Shafee
lua-env
A filter/shortcode extension for Quarto to provide access to LUA objects as metadata.
Mickaël CANOUIL
add-code-files
Filter to add code from source files as a code block that works with code-fold.
Shafayet Khan Shafee
code-fullscreen
Filter that adds a fullscreen button in the code blocks in revealjs slides and html documents.
Shafayet Khan Shafee
hide-comment
Filter that provides comment-directive to hide comment from code chunk in the rendered document (works for html/revealjs/pdf format).
Shafayet Khan Shafee
pseudocode
A Quarto filter extension to render pseudocode for html and pdf format.
范叶亮 | Leo Van
material-icons
Use Material Design Icons in HTML documents and Revealjs presentations.
Shafayet Khan Shafee
first-line-indent
Smart first-line indent for HTML/LaTeX/PDF outputs
Dialoa/Julien Dutant
reveal-header
Add header text and header logo in all pages of RevealJs slide
Shafayet Khan Shafee
black-formatter
Format the codes in python code-chunk using black formatter.
Shafayet Khan Shafee
recursive-citeproc
Handle self-citing bibliographies.
Dialoa/Julien Dutant
search-replace
Automatically search and replace strings in quarto documents upon rendering
Ute Hahn
interactive-sql
A Quarto filter to run SQL queries interactively from a SQLite database created at render time in html documents and Revealjs presentations.
Shafayet Khan Shafee
docx-horizontal-rule
A simple tool to edit the format of a horizontal rule in .docx output
Matt Capaldi
No matching items | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/index.html",
"source": "https://quarto.org/docs/extensions/index.html"
} |
Extensions are a powerful way to modify and extend the behavior of Quarto. Below is a listing of available extensions (please let us know if you have an extension you’d like to see added to the list).
See the articles on Creating Extensions to learn how to develop your own extensions.
Shortcode/Filter
Journal Articles
Custom Formats
Revealjs
Custom Formats
Name
Description
Author
sketchy-html
Sketchy HTML document using Rough Notation
schochastics
letter-pdf
PDF format for creating letters.
Mickaël CANOUIL
hikmah-pdf
Opinionated PDF format with support to biblatex-chicago and more.
andrewheiss
titlepage-pdf
PDF format with custom title page or book cover.
nmfs-opensci
inrae
INRAE formats for HTML, PDF, Docx, Revealjs, and Beamer
davidcarayon
bookup
HTML format providing light and dark themes and suitable for documents, books and websites
juba
fancy-doc
A PDF format that brings LaTeX’s fancyhdr package into Quarto for miscellaneous documents.
DamonCharlesRoberts
storybook-revealjs
Medieval inspired format for Revealjs
Mickaël CANOUIL
ceeos-revealjs
Dark grey / white based format for Revealjs
Mickaël CANOUIL
rladies-revealjs
R-Ladies format for Revealjs
beatrizmilz
onyxia-revealjs
Onyxia format for Revealjs
InseeFrLab
blackboard-revealjs
Blackboard like format for Revealjs
schochastics
nes-revealjs
NES.css format for Revealjs
EmilHvitfeldt
rlille-revealjs
R Lille (R User Group) format for Revealjs
Mickaël CANOUIL
metropolis-revealjs
Beamer Metropolis like format for Revealjs.
Shafayet Khan Shafee
illinois-revealjs
University of Illinois Urbana-Champaign inspired theme for the reveal.js format based on Metropolis.
James Joseph Balamuta
clean-revealjs
A minimal and elegant theme for reveal.js, inspired by modern Beamer templates.
Grant McDermott
No matching items | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/listing-formats.html",
"source": "https://quarto.org/docs/extensions/listing-formats.html"
} |
Overview
Quarto Extensions are a powerful way to modify or extend the behavior of Quarto, and can be created and distributed by anyone. There are several types of extensions available:
Extension
Description
Shortcodes
Special markdown directives that generate various types of content. For example, you could create shortcodes to embed tweets or videos in a document.
Filters
A flexible and powerful tool for introducing new global behaviors and/or new markdown rendering behaviors. For example, you could create filters to implement output folding, an image carousel, or just about anything you can imagine!
Journal Articles
Enable authoring of professional Journal articles using markdown, and produce both LaTeX (PDF) and HTML versions of the articles.
Custom Formats
Create new output formats by bundling together document options, templates, style sheets, and other content.
Revealjs Plugins
Extend the capabilities of HTML presentations created with Revealjs.
Project Types
Create new project project types that bundle together standard content and options, or make it easy to create a website for a custom HTML format.
Starter Templates
Help users get started with new projects by providing a template and example content. Starter templates aren’t strictly extensions (i.e. they aren’t installed in the _extensions directory) but they are often used with custom formats and project types.
Development
Each type of extension has its own development requirements: in some cases an extension can be created with YAML metadata alone, however in many cases you’ll end up doing some custom scripting using Lua.
These articles provide in-depth documentation on learning and using Lua for extension development:
Lua Development helps you get started with Lua (the language used to create extensions)
Lua API Documentation provides documentation on the Pandoc and Quarto Lua APIs used for creating extensions.
Distribution
There are two distinct ways to distribute extensions to end users:
Publish your extension in a public GitHub repository.
Bundle your extension into a .zip or .tar.gz archive.
Distributing Extensions goes into more depth on how to package and distribute extensions, both on GitHub and using plain gzip archives.
Examples
The documentation linked to above provides simple motivating examples for each type of extension. Once you understand these, check out the following for more sophisticated examples of each type of extension:
The Quarto Extensions GitHub organization provides a set of extensions developed by the core Quarto team. Many of these extensions implement frequently requested features, and all of them provide sound examples of how to implement extensions.
The Quarto Journals GitHub organization contains a set of Journal Article formats developed by the core Quarto team or contributed by third parties.
Finally, most published extensions are hosted on GitHub and therefore have source code available that you can learn from. | {
"lastmod": "2023-07-05T19:35:15.275Z",
"loc": "https://quarto.org/docs/extensions/creating.html",
"source": "https://quarto.org/docs/extensions/creating.html"
} |
Subscribe
Enjoy this blog? Get notified of new posts by email:
CategoriesAll (13)Authoring (6)Extensions (2)Features (9)Layout (1)Learn (2)Quarto 1.3 (5)Tables (1)conf (1)talk (1)workshop (1)
Quarto for Academics
A potpourri of Quarto features useful for academics
Learn
A video highlighting some of Quarto’s features that are especially useful for academics, as educators and as researchers.
May 22, 2023
Mine Çetinkaya-Rundel
Get Started with Quarto
A video to jumpstart your Quarto journey
Learn
A new video for getting started with Quarto using R and RStudio.
May 15, 2023
Mine Çetinkaya-Rundel
Quarto 1.3
Quarto 1.3 is officially released
Quarto 1.3
Quarto 1.3 brings new features, improvements, and fixes.
Apr 26, 2023
Charlotte Wickham
Confluence Publishing
Publish from Quarto to Confluence
Features
Authoring
Quarto 1.3
Quarto 1.3 adds support for publishing individual documents, and projects containing many documents to Atlassian Confluence.
Mar 20, 2023
Charlotte Wickham
Jupyter Notebook Cell Embedding
Embed output from an external Jupyter Notebook in a Quarto document
Features
Authoring
Quarto 1.3
Quarto 1.3 adds support for embedding cells from a Jupyter Notebook into a Quarto document via an embed shortcode. In HTML documents, links are automatically added that point to a rendered version of the external notebook.
Mar 17, 2023
Charlotte Wickham
Multi-format Publishing
Automatically link to other formats in HTML documents
Features
Authoring
Quarto 1.3
In Quarto 1.3, additional formats listed in HTML documents will automatically be linked in an “Other Formats” section near the top of the page.
Mar 15, 2023
Charlotte Wickham
Code Annotation
Add line based annotations to your code chunks
Features
Authoring
Quarto 1.3
In Quarto 1.3, you can add line based annotations to code chunks to highlight or explain parts of your code.
Mar 13, 2023
Charlotte Wickham
Shinylive Extension
Embed Shinylive applications in Quarto documents
Extensions
Features
With Shinylive, you can embed Shiny for Python applications into Quarto documents and run the entire application (including the Python runtime) inside the user’s web browser.
Oct 25, 2022
Winston Chang
Quarto Extensions
Extend Quarto with new capabilities
Extensions
Features
Quarto Extensions are a powerful way to modify or extend the behavior of Quarto, and can be created and distributed by anyone. Extension types include filters, shortcodes, and custom formats.
Jul 25, 2022
J.J. Allaire
Quarto at rstudio::conf(2022)
Quarto-related workshops and talks at rstudio::conf(2022)
conf
workshop
talk
rstudio::conf(2022) will feature a variety of workshops and talks on Quarto. Join us in Washington DC this July 25-28 to learn more about Quarto and hear from folks using Quarto to create, share, and collaborate.
Jun 21, 2022
Mine Çetinkaya-Rundel
Positioning Content in the Margin
Create ‘Tufte’ style documents with sidenotes, margin tables and figures, and other margin content
Features
Layout
This post demonstrates a few of the capabilities for positioning content in the margin of the page. You can read more about the complete capabilities in the the Article Layout Guide.
Feb 17, 2022
Charles Teague
Customizing Table Output
Author and customize markdown tables using Quarto
Features
Authoring
Tables
This post provides an overview of these capabilities in Quarto. For more detail about all the features Quarto for authoring tables, see Tables.
Feb 15, 2022
JJ Allaire
Using Callouts
Use callouts to draw attention to important complementary content without interupting the document flow
Features
Authoring
Callouts are an excellent way to draw extra attention to certain concepts, or to more clearly indicate that certain content is supplemental or applicable to only some scenarios.
Feb 13, 2022
Charles Teague
No matching items | {
"lastmod": "2023-07-05T19:35:15.215Z",
"loc": "https://quarto.org/docs/blog/index.html",
"source": "https://quarto.org/docs/blog/index.html"
} |
Quarto Extensions are a powerful way to modify or extend the behavior of Quarto, and can be created and distributed by anyone. There are three types of extensions available:
Shortcodes are special markdown directives that generate various types of content. For example, you could create shortcodes to embed tweets or videos in a document.
Filters are a flexible and powerful tool for introducing new global behaviors and/or new markdown rendering behaviors. For example, you could create filters to implement output folding, an image carousel, or just about anything you can imagine!
Formats enable you to create new output formats by bundling together document options, templates, stylesheets, and other content.
Here are some examples of extensions developed and maintained by the core Quarto team:
Extension
Description
lightbox
Create lightbox treatments for images in your HTML documents.
fancy-text
Output nicely formatted versions of fancy strings such as LaTeX and BibTeX in multiple formats.
fontawesome
Use Font Awesome icons in HTML and PDF documents.
latex-environment
Quarto extension to output custom LaTeX environments.
To learn more about using extensions, see the Extensions documentation on the Quarto website. If you want to dive in to creating your own extensions check out the articles on Creating Shortcodes, Creating Filters, and Creating Formats.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.223Z",
"loc": "https://quarto.org/docs/blog/posts/2022-07-25-feature-extensions/index.html",
"source": "https://quarto.org/docs/blog/posts/2022-07-25-feature-extensions/index.html"
} |
Quarto includes a number of features aimed at making it easy to to author and customize markdown table output, including:
Specifying column alignment and widths.
Providing captions, subcaptions, and cross-references.
Generating tables dynamically from executable code cells.
This post provides an overview of these capabilities in Quarto. For more detail about all the features Quarto for authoring tables, see Tables.
Markdown Tables
The most commonly used markdown table is known as a pipe table. Pipe tables support specifying per column alignment as well as captions. For example:
| Default | Left | Right | Center |
|---------|:-----|------:|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
: Demonstration of pipe table sytnax
Here is the table rendered to HTML:
Demonstration of pipe table syntax
Default
Left
Right
Center
12
12
12
12
123
123
123
123
1
1
1
1
Caption Location
By default, table captions are positioned above tables. You can modify this behavior using the tbl-cap-location option. For example:
---
tbl-cap-location: top
---
Explicit Column Widths
Beyond standard pipe table syntax for expressing column width, you can also explicitly specify columns widths using the tbl-colwidths attribute or document-level option. For an individual markdown table, add the attribute after the caption. For example:
| fruit | price |
|--------|--------:
| apple | 2.05 |
| pear | 1.37 |
| orange | 3.09 |
: Fruit prices {tbl-colwidths="[75,25]"}
Note that this option is specified at the top level so that it can be shared by both PDF and HTML formats. If you are only targeting a single format you can place it alongside other format specific options.
Valid values for the caption location include:
Value
Description
top
Position the caption above the table.
bottom
Position the caption below the table.
margin
Position the caption in the margin.
Computations
All of the options described above work for tables produced by executable code cells. For example, here we apply the tbl-cap, tbl-colwidths and tbl-caption-location options to a code cell:
```{r}
#| tbl-cap: "Cars"
#| tbl-colwidths: [60,40]
#| tbl-cap-location: margin
library(knitr)
kable(head(cars))
```
In addition to the above, which focused on some of the features of Quarto when writing pipe tables in markdown, you can also author tables using grid syntax. You review the documentation. for more detail.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.215Z",
"loc": "https://quarto.org/docs/blog/posts/2022-02-15-feature-tables/index.html",
"source": "https://quarto.org/docs/blog/posts/2022-02-15-feature-tables/index.html"
} |
Callouts are an excellent way to draw extra attention to certain concepts, or to more clearly indicate that certain content is supplemental or applicable to only some scenarios.
Callout Basics
There are five different types of callouts available.
note
tip
important
caution
warning
The color and icon will be different depending upon the type that you select.
Syntax
Create callouts in markdown using the following syntax (note that the first markdown heading used within the callout is used as the callout heading):
:::{.callout-note}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
:::{.callout-tip}
## Tip With Caption
This is an example of a callout with a caption.
:::
See our documentation on Callouts, to learn more, including more about how to customize the appearance and behavior of callouts.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.215Z",
"loc": "https://quarto.org/docs/blog/posts/2022-02-13-feature-callouts/index.html",
"source": "https://quarto.org/docs/blog/posts/2022-02-13-feature-callouts/index.html"
} |
import pandas as pd
import altair as alt
import seaborn as sns
from matplotlib import pyplot as plt
Data from Palmer Penguins R package
penguins = pd.read_csv("https://pos.it/palmer-penguins-github-csv")
penguins.groupby("species").size().reset_index(name = "count")
species
count
0
Adelie
152
1
Chinstrap
68
2
Gentoo
124
colors = ["#FF8C00", "#A020F0", "#008B8B"]
sns.set_palette(colors, n_colors = 3)
penguins["bill_ratio"] = (
penguins["bill_length_mm"] / penguins["bill_depth_mm"]
)
sns.displot(penguins,
x = "bill_ratio",
hue = "species",
kind = "kde", fill = True, aspect = 2, height = 3)
plt.show()
sns.displot(penguins,
x = "bill_depth_mm",
hue = "species",
kind = "kde", fill = True,
aspect = 2, height = 3)
plt.show()
sns.displot(penguins,
x = "bill_length_mm",
hue = "species",
kind = "kde", fill = True,
aspect = 2, height = 3)
plt.show()
(a) Gentoo penguins tend to have thinner bills,
(b) and Adelie penguins tend to have shorter bills.
Figure 1: Marginal distributions of bill dimensions
scale = alt.Scale(domain = ['Adelie', 'Chinstrap', 'Gentoo'],
range = colors)
alt.Chart(penguins).mark_circle(size=60).encode(
alt.X('bill_length_mm',
scale=alt.Scale(zero=False)
),
alt.Y('bill_depth_mm',
scale=alt.Scale(zero=False)
),
color = alt.Color('species', scale = scale),
tooltip=['species', 'sex', 'island']
)
Figure 2: A scatterplot of bill dimensions for penguins, made with Altair.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.231Z",
"loc": "https://quarto.org/docs/blog/posts/2023-03-17-jupyter-cell-embedding/penguins.html",
"source": "https://quarto.org/docs/blog/posts/2023-03-17-jupyter-cell-embedding/penguins.html"
} |
Quarto offers a myriad of features that are especially useful for academics, as educators and as researchers. These range from chunk options that enable automatic linking of code to documentation, to article templates for manuscript submission to multiple journals. The following video walks you through some of these features.
Select highlights include:
Linking to documentation from code with code-link.
Informative YAML errors and YAML completion.
Creating Quarto slides with revealjs.
PDF export of HTML slides.
Annotating slides with chalkboard.
Advancing slides for your audience with multiplex.
Highlighting code with code-line-numbers.
Customizing output location with output-location.
Showing code chunk fences with echo: fenced.
Code annotation.
Authoring manuscripts with Quarto journal templates.
Inserting citations from Zotero or from a DOI with the RStudio Visual Editor.
If you would like to follow along as you watch, you can find the source code for everything created in the video in this GitHub repository.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.251Z",
"loc": "https://quarto.org/docs/blog/posts/2023-05-22-quarto-for-academics/index.html",
"source": "https://quarto.org/docs/blog/posts/2023-05-22-quarto-for-academics/index.html"
} |
rstudio::conf(2022) will feature a variety of workshops and talks on Quarto. Join us in Washington DC this July 25-28 to learn more about Quarto and hear from folks using Quarto to create, share, and collaborate.
Here is a list of Quarto-related talks and workshops (and scroll down for details on each):
Keynote: Reimagine + Collaborate + Share with Quarto
Workshops:
Getting Started with Quarto
From R Markdown to Quarto
Talks:
Quarto for R Markdown users
These are a few of my favorite things (about Quarto presentations)
Literate Programming With Jupyter Notebooks and Quarto
Websites & Books & Blogs, oh my! Creating Rich Content with Quarto
Keynote
Reimagine + Collaborate + Share with Quarto (Keynote): (Talk recording)
Presented by Julia Stewart Lowndes (Director, Openscapes) and Mine Çetinkaya-Rundel (Developer Educator at RStudio and Professor at Duke University).
Thursday July 28, 9:00am - 10:00am EDT.
What is Quarto? In this talk, in four acts, we will discuss how Quarto unifies and extends the R Markdown ecosystem. Through our work with NASA Openscapes, Duke University, and RStudio, we will share our experiences authoring, teaching, and collaborating with Quarto. Full of demos with Quarto in RStudio and Jupyter and weaving together narrative, R, and Python code, we will showcase features of Quarto that have enabled us to reimagine our reproducible workflows. This talk will help you get the most out of Quarto regardless of your background with R Markdown, the computing language(s) you use, and your tool of choice for authoring.
Workshops
We will have two Quarto workshops at the conference, held on July 25-26, one for those who have no or little prior experience with R Markdown and the other for those who want to take their R Markdown skills and expertise and apply them in Quarto.
Getting Started with Quarto: This workshop is designed for those who have no or little prior experience with R Markdown. In this 2 day workshop you will learn about the Quarto format for technical communication and computation. The workshop will teach you how to get started creating and fully customizing Quarto outputs (HTML, PDF, Presentations) and the use of RStudio’s Visual Editor which provides a user interface for editing all of Pandoc markdown. The workshop will also provide an overview of Quarto’s developer tooling support in alternative tools such as Jupyter, VS Code, and any text editors. The workshop will briefly cover how to add interactivity to Quarto with Shiny, Observable JS, htmlwidgets or Jupyter Widgets. Lastly, the workshop will cover Quarto Projects for aggregating many files such as complex web sites or entire books. Presented by Tom Mock, Customer Enablement Lead at RStudio, this workshop will be appropriate for attendees who answer yes to these questions:
Have you programmed in R and want to better encapsulate your code, documentation, and outputs in a cohesive “data product”?
Do you want to learn about the next generation of RMarkdown for data science?
Do you want to have a better interactive experience when writing technical or scientific documents with literate programming?
Find out more about this workshop and register at https://www.rstudio.com/conference/2022/workshops/get-started-quarto/.
From R Markdown to Quarto: This workshop is designed for those who want to take their R Markdown skills and expertise and apply them in Quarto. In this workshop you will learn how to apply your reproducible authoring skills to the Quarto format and learn about new tools and workflows for authoring with Quarto in RStudio. You will learn to create static documents, to add interactivity to them with Shiny and htmlwidgets, and to create presentations in various formats such as reveal.js, beamer, and pptx. The workshop will also introduce you to Quarto projects which you can use to build websites and write blogs and books. Finally, you will learn various ways to deploy and publish your Quarto projects on the web. Independent modules will also highlight authoring in Quarto with Jupyter and VS Code as well as other text editors. Presented by Andrew Bray, Associate Teaching Professor in the Department of Statistics at UC Berkeley, this workshop will be appropriate for you if you answer yes to any of these questions:
Have you authored R Markdown documents and are you interested in migrating your workflow to its successor format, Quarto?
Are you interested in exploring the wide spectrum of documents that can be produced with Quarto, including static documents, websites, and slides?
Find out more about this workshop and register at https://www.rstudio.com/conference/2022/workshops/rmd-to-quarto.
Talks
Quarto for R Markdown users: (Talk recording)
Presented by Tom Mock, Customer Enablement Lead at RStudio.
Wednesday July 27, 3:20pm - 3:40pm EDT.
Are you curious about Quarto? Maybe you saw it on Twitter or the RStudio::conf agenda. Perhaps this raised questions like: What exactly is Quarto? What about RMarkdown? (don’t worry it’s not going away!) What features does Quarto add? What should I do with my existing Rmd/ipynb files? This talk will answer all of those questions and more! I’ll present Quarto as a next-gen version of RMarkdown, compare the similarities, and then discuss the new features in Quarto for publishing documents, presentations, blog posts, lab notebooks and more! Lastly, I’ll cover what this means for our customers using RStudio Team, and the exciting new world for Python users.
These are a few of my favorite things (about Quarto presentations): (Talk recording)
Presented by Tracy Teal, Open Source Program Director at RStudio.
Thursday July 28, 2022 3:20pm - 3:40pm EDT.
Quarto is the next generation of RMarkdown, and comes with a new presentation format, revealjs. In this talk, I’ll show a few of my favorite things about making interactive HTML presentations with Quarto. Along the way you’ll learn about the visual editor, multiple columns, delivering an effective talk with speaker notes and mode, making your presentations pop with transitions, effective ways to incorporate code into your presentation, beautiful themes (and how to match your corporate style guide), and sharing it as pdf and HTML. I’ll finish off with a brief look at generating a PowerPoint presentation from a template.
Literate Programming With Jupyter Notebooks and Quarto: (Talk recording)
Presented by Hamel Husain, head of Data Science at Outerbounds (the developers of Metaflow) and core developer at fast.ai.
Thursday July 28, 3:40pm - 4:00pm EDT.
Jupyter Notebooks play a critical role in in the workflow of many users. Notebooks are used to document existing code, to quickly prototype and iterate on ideas, and as a medium of technical communication. However, package developers typically use an entirely separate set of more traditional development tools, and the context switching between these tools and notebooks can be frustrating. Not only do you lose the ability to iterate fast, but you lose the ability to document and test your code in-situ, requiring you to create documentation and tests separately from source code. Nbdev is a literate programming framework that allows you to develop Python libraries within Jupyter Notebooks. This talk will describe the integration between Nbdev and Quarto, which enables library developers to author their documentation right alongside their code, and automatically produce a Quarto website for their package. The result is a seamless workflow for developing, documenting, and testing software packages all within Jupyter Notebooks, with no context-switching required.
Websites & Books & Blogs, oh my! Creating Rich Content with Quarto: (Talk recording)
Presented by Devin Pastoor, Solutions Engineer at RStudio.
Thursday July 28, 4:00pm - 4:20pm EDT.
A number of packages have emerged in the R ecosystem to help create websites (hugodown), books (bookdown), and blogs (blogdown). In this talk, I’ll show you how Quarto handles creating these types of content and more. Whether you’re a grad student considering your first blog post about R, or a python expert about to write a technical book, I’ll show you how Quarto enables you to focus on content while it takes care of the rest. In addition, I’ll show the RStudio team is making it as easy as possible to publish and share content within your organization and to the whole community.
To find out more about the conference and register, visit rstd.io/conf. Looking forward to seeing you in DC!
Can’t make it to the conference in person, but don’t want to miss this content? You can follow along with the talks remotely via the live stream and we will share materials from the workshops in a post-conf roundup post.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.219Z",
"loc": "https://quarto.org/docs/blog/posts/2022-06-21-rstudio-conf-2022-quarto/index.html",
"source": "https://quarto.org/docs/blog/posts/2022-06-21-rstudio-conf-2022-quarto/index.html"
} |
Quarto supports a variety of page layout options that enable you to author content that
Fills the main content region
Overflows the content region
Spans the entire page
Occupies the document margin
This post will demonstrate a few of the capabilities for positioning content in the margin of the page. You can read more about the complete capabilities in the the Article Layout Guide.
Margin Figures
Figures that you create using code cells can be placed in the margin by using the column: margin code cell option. If the code produces more than one figure, each of the figures will be placed in the margin.
```{r}
#| label: fig-mtcars
#| fig-cap: "MPG vs horsepower, colored by transmission."
#| column: margin
library(ggplot2)
mtcars2 <- mtcars
mtcars2$am <- factor(
mtcars$am, labels = c('automatic', 'manual')
)
ggplot(mtcars2, aes(hp, mpg, color = am)) +
geom_point() + geom_smooth(formula = y ~ x, method = "loess") +
theme(legend.position = 'bottom')
```
Figure 1: MPG vs horsepower, colored by transmission.
Margin Tables
You an also place tables in the margin of your document by specifying column: margin.
```{r}
#| column: margin
knitr::kable(
mtcars[1:3, 1:3]
)
```
mpg
cyl
disp
Mazda RX4
21.0
6
160
Mazda RX4 Wag
21.0
6
160
Datsun 710
22.8
4
108
Other Content
You can also place content in the margin by targeting the margin column using a div with the .column-margin class. For example:
::: {.column-margin}
We know from *the first fundamental theorem of calculus* that for $x$ in $[a, b]$:
$$\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).$$
:::
We know from the first fundamental theorem of calculus that for \(x\) in \([a, b]\):
\[\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).\]
Margin References
Footnotes and the bibliography typically appear at the end of the document, but you can choose to have them placed in the margin by setting the following option[^1] in the document front matter:
---
reference-location: margin
citation-location: margin
---
With these options set, footnotes and citations will (respectively) be automatically be placed in the margin of the document rather than the bottom of the page. As an example, when I cite Xie, Allaire, and Grolemund (2018), the citation bibliography entry itself will now appear in the margin.
Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown.
Asides
Asides allow you to place content aside from the content it is placed in. Asides look like footnotes, but do not include the footnote mark (the superscript number). This is a span that has the class aside which places it in the margin without a footnote number.
[This is a span that has the class aside which places it in the margin without a footnote number.]{.aside}
Margin Captions
For figures and tables, you may leave the content in the body of the document while placing the caption in the margin of the document. Using cap-location: margin in a code cell or document front matter to control this. For example:
```{r}
#| label: fig-cap-margin
#| fig-cap: "MPG vs horsepower, colored by transmission."
#| cap-location: margin
library(ggplot2)
mtcars2 <- mtcars
mtcars2$am <- factor(
mtcars$am, labels = c('automatic', 'manual')
)
ggplot(mtcars2, aes(hp, mpg, color = am)) +
geom_point() + geom_smooth(formula = y ~ x, method = "loess") +
theme(legend.position = 'bottom')
```
Figure 2: MPG vs horsepower, colored by transmission.
Subscribe
Enjoy this blog? Get notified of new posts by email: | {
"lastmod": "2023-07-05T19:35:15.215Z",
"loc": "https://quarto.org/docs/blog/posts/2022-02-17-advanced-layout/index.html",
"source": "https://quarto.org/docs/blog/posts/2022-02-17-advanced-layout/index.html"
} |
Observable JS is a set of enhancements to vanilla JavaScript created by Mike Bostock (also the author of D3). Observable JS is distinguished by its reactive runtime, which is especially well suited for interactive data exploration and analysis.
Learn more about using Observable JS with Quarto in the articles on Interactive Documents with Observable JS.
Overview
Cell options affect the execution and output of executable code blocks. They are specified within comments at the top of a block. For example:
```{ojs}
//| label: fig-polar
//| echo: false
//| fig-cap: "A line plot on a polar axis"
```
Attributes
label
Unique label for code cell. Used when other code needs to refer to the cell (e.g. for cross references fig-samples or tbl-summary)
classes
Classes to apply to cell container
Code Output
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
code-fold
Collapse code into an HTML <details> tag so the user can display it on-demand.
true: collapse code
false (default): do not collapse code
show: use the <details> tag, but show the expanded code initially.
code-summary
Summary text to use for code blocks collapsed using code-fold
code-overflow
Choose how to handle code overflow, when code lines are too wide for their container. One of:
scroll
wrap
code-line-numbers
Include line numbers in code block output (true or false).
For revealjs output only, you can also specify a string to highlight specific lines (and/or animate between sets of highlighted lines).
Sets of lines are denoted with commas:
3,4,5
1,10,12
Ranges can be denoted with dashes and combined with commas:
1-3,5
5-10,12,14
Finally, animation steps are separated by |:
1-3|1-3,5 first shows 1-3, then 1-3,5
|5|5-10,12 first shows no numbering, then 5, then lines 5-10 and 12
lst-label
Unique label for code listing (used in cross references)
lst-cap
Caption for code listing
Cell Output
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
panel
Panel type for cell output (tabset, input, sidebar, fill, center)
output-location
Location of output relative to the code that generated it. The possible values are as follows:
default: Normal flow of the slide after the code
fragment: In a fragment (not visible until you advance)
slide: On a new slide after the curent one
‘column’: In an adjacent column
column-fragment: In an adjacent column (not visible until you advance)
Note that this option is supported only for the revealjs format.
Figures
fig-cap
Figure caption
fig-subcap
Figure subcaptions
fig-link
Hyperlink target for the figure
fig-align
Figure horizontal alignment (default, left, right, or center)
fig-alt
Alternative text to be used in the alt attribute of HTML images.
fig-env
LaTeX environment for figure output
fig-pos
LaTeX figure position arrangement to be used in \begin{figure}[].
Computational figure output that is accompanied by the code that produced it is given a default value of fig-pos="H" (so that the code and figure are not inordinately separated).
If fig-pos is false, then we don’t use any figure position specifier, which is sometimes necessary with custom figure environments (such as sidewaysfigure).
fig-scap
A short caption (only used in LaTeX output). A short caption is inserted in \caption[], and usually displayed in the “List of Figures” of a PDF document.
Tables
tbl-cap
Table caption
tbl-subcap
Table subcaptions
Panel Layout
layout
2d-array of widths where the first dimension specifies columns and the second rows.
For example, to layout the first two output blocks side-by-side on the top with the third block spanning the full width below, use [[3,3], [1]].
Use negative values to create margin. For example, to create space between the output blocks in the top row of the previous example, use [[3,-1, 3], [1]].
layout-ncol
Layout output blocks into columns
layout-nrow
Layout output blocks into rows
layout-align
Horizontal alignment for layout content (default, left, right, or center)
layout-valign
Vertical alignment for layout content (default, top, center, or bottom)
Page Columns
column
Page column for output
fig-column
Page column for figure output
tbl-column
Page column for table output
cap-location
Where to place figure and table captions (top, bottom, or margin)
fig-cap-location
Where to place figure captions (top, bottom, or margin)
tbl-cap-location
Where to place table captions (top, bottom, or margin) | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/reference/cells/cells-ojs.html",
"source": "https://quarto.org/docs/reference/cells/cells-ojs.html"
} |
All available options for website projects are documented below. See Creating a Website for an in-depth guide to creating websites with Quarto.
Project
Options that define the type, render targets, and output of a project. Project options are specified under the project key. For example:
---
project:
type: website
output-dir: _site
---
title
type
Project type (default, website, or book)
render
Files to render (defaults to all files)
execute-dir
Control the working directory for computations.
file: Use the directory of the file that is currently executing.
project: Use the root directory of the project.
output-dir
Output directory
lib-dir
HTML library (JS/CSS/etc.) directory
resources
Additional file resources to be copied to output directory
preview
Options for quarto preview (see Preview)
pre-render
Scripts to run as a pre-render step
post-render
Scripts to run as a post-render step
Preview
Specify options that control the behavior of quarto preview within the preview key. For example:
---
project:
type: website
output-dir: _site
preview:
port: 4200
browser: false
---
Available preview options include:
port
Port to listen on (defaults to random value between 3000 and 8000)
host
Hostname to bind to (defaults to 127.0.0.1)
serve
Options for external preview server (see Serve)
browser
Open a web browser to view the preview (defaults to true)
watch-inputs
Re-render input files when they change (defaults to true)
navigate
Navigate the browser automatically when outputs are updated (defaults to true)
timeout
Time (in seconds) after which to exit if there are no active clients
Serve
If you are creating a project extension for another publishing system that includes its own preview server (for example, Hugo or Docusaurus) then use the preview: serve options to customize the behavior of the preview server.
cmd
Serve project preview using the specified command. Interpolate the --port into the command using {port}.
args
Additional command line arguments for preview command.
env
Environment variables to set for preview command.
ready
Regular expression for detecting when the server is ready.
See the Hugo and Docusaurus extension source code for example usages of preview: serve.
Website
Options that affect website output. Website options are specified under the website key. For example:
---
website:
title: "My Website"
image: opengraph.png
page-navigation: true
---
title
Website title
description
Website description
favicon
The path to the favicon for this website
site-url
Base URL for published website
site-path
Path to site (defaults to /). Not required if you specify site-url.
repo-url
Base URL for website source code repository
repo-subdir
Subdirectory of repository containing website
repo-branch
Branch of website source code (defaults to main)
issue-url
URL to use for the ‘report an issue’ repository action.
repo-actions
Links to source repository actions (none or one or more of edit, source, issue)
reader-mode
Displays a ‘reader-mode’ tool which allows users to hide the sidebar and table of contents when viewing a page.
google-analytics
The Google tracking Id or measurement Id of this website.
cookie-consent
The type of consent that should be requested, using one of these two values:
implied (default): This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.
express: This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).
search
Site search (true or false to enable/disable, or provide custom Search Options
navbar
Navbar options (see Navbar)
sidebar
Sidebar options (see Sidebar)
body-header
Markdown to insert at the beginning of each page’s body (below the title and author block).
body-footer
Markdown to insert below each page’s body.
margin-header
Markdown to place above margin content (text or file path)
margin-footer
Markdown to place below margin content (text or file path)
page-navigation
Provide next and previous article links in footer
back-to-top-navigation
Provide a ‘back to top’ navigation button
page-footer
Page footer. Text content or page footer definition.
image
Default site thumbnail image for twitter /open-graph
comments
open-graph
Generate Open Graph metadata (see Open Graph options)
twitter-card
Generate Twitter Card metadata (see Twitter Card options)
Navbar
Options that define the top navigation bar for a website For example:
---
website:
navbar:
search: true
---
title
The navbar title. Uses the project title if none is specified.
logo
Path to a logo image that will be displayed to the left of the title.
logo-alt
Alternate text for the logo image.
logo-href
Target href from navbar logo / title. By default, the logo and title link to the root page of the site (/index.html).
background
The navbar’s background color (named or hex color).
foreground
The navbar’s foreground color (named or hex color).
search
Include a search box in the navbar.
pinned
Always show the navbar (keeping it pinned).
collapse
Collapse the navbar into a menu when the display becomes narrow.
collapse-below
The responsive breakpoint below which the navbar will collapse into a menu (sm, md, lg (default), xl, xxl).
left
List of items for the left side of the navbar (see Nav Items)
right
List of items for the left side of the navbar (see Nav Items)
Nav Items
Nav items appear in the left or right key of navbar definitions. For example:
---
website:
navbar:
right:
- icon: github
href: https://github.com/
aria-label: GitHub
---
aria-label
Accessible label for the item.
href
Link to file contained with the project or external URL
icon
Name of bootstrap icon (e.g. github, twitter, share) See https://icons.getbootstrap.com/ for a list of available icons
menu
Submenu of navigation items
text
Text to display for item (defaults to the document title if not provided)
rel
Value for rel attribute. Multiple space-separated values are permitted. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel for a details.
target
Value for target attribute. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target for details.
Note that the icon option is available for items in the Navbar, however items in the Sidebar do not support the icon option.
Sidebar
Options that define the side navigation area for a website. For example:
---
website:
sidebar:
search: true
---
id
The identifier for this sidebar.
title
The sidebar title. Uses the project title if none is specified.
logo
Path to a logo image that will be displayed in the sidebar.
search
Include a search control in the sidebar.
tools
List of sidebar tools (see Sidebar Tools)
contents
List of navigation items to appear in the sidebar. Can also include section entries which in turn contain sub-lists of navigation items.
style
The style of sidebar (docked or floating).
background
The sidebar’s background color (named or hex color).
foreground
The sidebar’s foreground color (named or hex color).
border
Whether to show a border on the sidebar (defaults to true for ‘docked’ sidebars)
alignment
Alignment of the items within the sidebar (left, right, or center)
collapse-level
The depth at which the sidebar contents should be collapsed by default.
pinned
When collapsed, pin the collapsed sidebar to the top of the page.
header
Markdown to place above sidebar content (text or file path)
footer
Markdown to place below sidebar content (text or file path)
Sidebar Tools
Action buttons that appear on the sidebar. For example:
---
website:
sidebar:
tools:
- icon: github
href: https://github.com/
---
icon
Name of bootstrap icon (e.g. github, twitter, share) See https://icons.getbootstrap.com/ for a list of available icons
href
Link to file contained with the project or external URL
menu
Submenu of navigation items
Footer
Website page footer definition. For example:
---
website:
page-footer:
center:
- text: "About"
href: about.qmd
- text: "License"
href: license.qmd
- text: "Trademark"
href: trademark.qmd
---
left
Footer left content
right
Footer right content
center
Footer center content
border
Footer border (true, false, or a border color)
background
Footer background color
foreground
Footer foreground color
Search
Search options are specified under the search key of website. For example:
website:
search:
location: navbar
type: overlay
---
location
Location for search widget (navbar or sidebar)
type
Type of search UI (overlay or textbox)
limit
Number of matches to display (defaults to 20)
collapse-after
Matches after which to collapse additional results
copy-button
Provide button for copying search link
algolia
Use an Algolia index for site search (see Algolia Options)
Algolia Options
You can use an Algolia index as the back end of website search. Specify Algolia options using the algolia sub-key of search, for example:
---
website:
search:
algolia:
index-name: <my-index-name>
application-id: <my-application-id>
search-only-api-key: <my-search-only-api-key>
---
index-name
The name of the index to use when performing a search
application-id
The unique ID used by Algolia to identify your application
search-only-api-key
The Search-Only API key to use to connect to Algolia
analytics-events
Enable tracking of Algolia analytics events
show-logo
Enable the display of the Algolia logo in the search results footer.
index-fields
Fields to target for searches (see below for details)
params
Additional parameters to pass when executing a search
The index-fields option provides sub-fields within the Algolia index to target for searches:
href
Field that contains the URL of index entries
title
Field that contains the title of index entries
text
Field that contains the text of index entries
section
Field that contains the section of index entries
Social
Social metadata is provided as a subkey of website options. You can specify true to generate social metadata using a set of default option, or specify one or more Twitter or Open Graph specific options as enumerated below. For example:
---
website:
open-graph: true
twitter-card:
site: "@sitehandle"
---
Twitter Card
title
The title of the page. Note that by default Quarto will automatically use the title metadata from the page. Specify this field if you’d like to override the title for this provider.
description
A short description of the content. Note that by default Quarto will automatically use the description metadata from the page. Specify this field if you’d like to override the description for this provider.
image
The path to a preview image for the content. By default, Quarto will use the image value from the format metadata. If you provide an image, you may also optionally provide an image-width and image-height.
image-alt
The alt text for the preview image. By default, Quarto will use the image-alt value from the format metadata. If you provide an image, you may also optionally provide an image-width and image-height.
image-width
Image width (pixels)
image-height
Image height (pixels)
card-style
Card style (summary or summary_large_image).
If this is not provided, the best style will automatically selected based upon other metadata. You can learn more about Twitter Card styles here.
creator
@username of the content creator (must be a quoted string)
site
@username of the website (must be a quoted string)
Open Graph
title
The title of the page. Note that by default Quarto will automatically use the title metadata from the page. Specify this field if you’d like to override the title for this provider.
description
A short description of the content. Note that by default Quarto will automatically use the description metadata from the page. Specify this field if you’d like to override the description for this provider.
image
The path to a preview image for the content. By default, Quarto will use the image value from the format metadata. If you provide an image, you may also optionally provide an image-width and image-height.
image-alt
The alt text for the preview image. By default, Quarto will use the image-alt value from the format metadata. If you provide an image, you may also optionally provide an image-width and image-height.
image-width
Image width (pixels)
image-height
Image height (pixels)
locale
Locale of open graph metadata
site-name
Name that should be displayed for the overall site. If not explicitly provided in the open-graph metadata, Quarto will use the website or book title by default.
Comments
You can add commenting to your website using either Hypothesis, Utterances, or Giscus.
Hypothesis
Enable and configure Hypothesis commenting via comments key. For example:
---
website:
comments:
hypothesis:
theme: clean
openSidebar: false
---
openSidebar
Controls whether the sidebar opens automatically on startup.
showHighlights
Controls whether the in-document highlights are shown by default (always, whenSidebarOpen or never)
theme
Controls the overall look of the sidebar (classic or clean)
enableExperimentalNewNoteButton
Controls whether the experimental New Note button should be shown in the notes tab in the sidebar.
usernameUrl
Specify a URL to direct a user to, in a new tab. when they click on the annotation author link in the header of an annotation.
services
Array of service definitions
branding
Custom branding/colors to apply to UI
externalContainerSelector
A CSS selector specifying the containing element into which the sidebar iframe will be placed.
focus
User focused filter set for the available annotations on a page
requestConfigFromFrame
Specify a host iframe to request configuration from
assetRoot
The root URL from which assets are loaded.
sidebarAppUrl
The URL for the sidebar application which displays annotations.
For additional documentation on the Hypothesis options enumerated above, see the Hypothesis Publisher Config documentation.
Utterances
Enable and configure Utterances commenting via the comments key. For example:
---
website:
comments:
utterances:
repo: quarto-dev/quarto-web
---
repo
The Github repo that will be used to store comments.
label
The label that will be assigned to issues created by Utterances.
theme
The Github theme that should be used for Utterances (github-light, github-dark, github-dark-orange, icy-dark, dark-blue, photon-dark, body-light, or gruvbox-dark)
issue-term
How posts should be mapped to Github issues (pathname, url, title or og:title)
Giscus
Enable and configure usage of the Giscus app via the comments key. For example:
---
website:
comments:
giscus:
repo: quarto-dev/quarto-web
---
repo
The Github repo that will be used to store comments.
In order to work correctly, the repo must be public, with the giscus app installed, and the discussions feature must be enabled.
repo-id
The Github repository identifier.
You can quickly find this by using the configuration tool at https://giscus.app. If this is not provided, Quarto will attempt to discover it at render time.
category
The discussion category where new discussions will be created. It is recommended to use a category with the Announcements type so that new discussions can only be created by maintainers and giscus.
category-id
The Github category identifier.
You can quickly find this by using the configuration tool at https://giscus.app. If this is not provided, Quarto will attempt to discover it at render time.
mapping
The mapping between the page and the embedded discussion.
pathname: The discussion title contains the page path
url: The discussion title contains the page url
title: The discussion title contains the page title
og:title: The discussion title contains the og:title metadata value
any other string or number: Any other strings will be passed through verbatim and a discussion title containing that value will be used. Numbers will be treated as a discussion number and automatic discussion creation is not supported.
reactions-enabled
Display reactions for the discussion’s main post before the comments.
loading
Specify loading: lazy to defer loading comments until the user scrolls near the comments container.
input-position
Place the comment input box above or below the comments.
theme
The giscus theme to use when displaying comments.
language
The language that should be used when displaying the commenting interface.
Listings
Listings enable you to automatically generate the contents of a page (or region of a page) from a list of Quarto documents or other custom data. You can enable listings on a page using the listing option in the document front matter, for example:
---
title: "Listing Example"
listing: default
---
id
The id of this listing. When the listing is rendered, it will place the contents into a div with this id. If no such div is defined on the page, a div with this id will be created and appended to the end of the page.
In no id is provided for a listing, Quarto will synthesize one when rendering the page.
type
The type of listing to create. Choose one of:
default: A blog style list of items
table: A table of items
grid: A grid of item cards
custom: A custom template, provided by the template field
contents
The files or path globs of Quarto documents or YAML files that should be included in the listing.
sort
Sort items in the listing by these fields. The sort key is made up of a field name followed by a direction asc or desc.
For example: date asc
Use sort:false to use the unsorted original order of items.
max-items
The maximum number of items to include in this listing.
page-size
The number of items to display on a page.
sort-ui
Shows or hides the sorting control for the listing. To control the fields that will be displayed in the sorting control, provide a list of field names.
filter-ui
Shows or hides the filtering control for the listing. To control the fields that will be used to filter the listing, provide a list of field names. By default all fields of the listing will be used when filtering.
categories
Display item categories from this listing in the margin of the page.
numbered: Category list with number of items
unnumbered: Category list
cloud: Word cloud style categories
feed
Create an RSS feed for this page using the items in this listing (see Feed).
date-format
The date format to use when displaying dates (e.g. d-M-yyy). Learn more about supported date formatting values here.
max-description-length
The maximum length (in characters) of the description displayed in the listing. Defaults to 175.
image-placeholder
The default image to use if an item in the listing doesn’t have an image.
image-align
In default type listings, whether to place the image on the right or left side of the post content (left or right).
image-height
The height of the image being displayed (a CSS height string).
The width is automatically determined and the image will fill the rectangle without scaling (cropped to fill).
grid-columns
In grid type listings, the number of columns in the grid display. Defaults to 3.
grid-item-border
In grid type listings, whether to display a border around the item card. Defaults to true.
grid-item-align
In grid type listings, the alignment of the content within the card (left (default), right, or center).
table-striped
In table type listings, display the table rows with alternating background colors. Defaults to false.
table-hover
In table type listings, highlight rows of the table when the user hovers the mouse over them. Defaults to false.
template
The path to a custom listing template.
template-params
Parameters that are passed to the custom template.
fields
The list of fields to include in this listing.
field-display-names
A mapping that provides display names for specific fields. For example, to display the title column as ‘Report’ in a table listing you would write:
listing:
field-display-names:
title: "Report"
field-types
Provides the date type for the field of a listing item. Unknown fields are treated as strings unless a type is provided. Valid types are date, number.
field-links
The list of fields to display as hyperlinks to the source document when the listing type is a table. By default, only the title or filename is displayed as a link.
field-required
Fields that items in this listing must have populated. If a listing is rendered and one more items in this listing is missing a required field, an error will occur and the render will.
include
Items with matching field values will be included in the listing.
exclude
Items with matching field values will be excluded from the listing.
Feed
Enable an RSS feed for your listing by including the feed option.
items
The number of items to include in your feed. Defaults to 20.
type
Whether to include full or partial content in the feed.
full (default): Include the complete content of the document in the feed.
partial: Include only the first paragraph of the document in the feed.
title
The title for this feed. Defaults to the site title provided the Quarto project.
image
The path to an image for this feed. If not specified, the image for the page the listing appears on will be used, otherwise an image will be used if specified for the site in the Quarto project.
description
The description of this feed. If not specified, the description for the page the listing appears on will be used, otherwise the description of the site will be used if specified in the Quarto project.
language
The language of the feed. Omitted if not specified. See https://www.rssboard.org/rss-language-codes for a list of valid language codes.
categories
A list of categories for which to create separate RSS feeds containing only posts with that category.
About
Layout a simple about page for an individual or organization. For more, see the About Pages documentation.
id
The target id of this about page. When the about page is rendered, it will place read the contents of a div with this id into the about template that you have selected (and replace the contents with the rendered about content).
If no such div is defined on the page, a div with this id will be created and appended to the end of the page.
template
The template to use to layout this about page. Choose from:
jolla
trestles
solana
marquee
broadside
image
The path to the main image on the about page. If not specified, the image provided for the document itself will be used.
image-width
A valid CSS width for the about page image.
image-shape
The shape of the image on the about page.
rectangle
round
rounded
links
Links (as navigation items) to display on the about page. | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/projects/websites.html",
"source": "https://quarto.org/docs/reference/projects/websites.html"
} |
Options that define the type, render targets, and output of a project. Project options are specified under the project key. For example:
---
project:
type: default
output-dir: _output
---
title
type
Project type (default, website, or book)
render
Files to render (defaults to all files)
execute-dir
Control the working directory for computations.
file: Use the directory of the file that is currently executing.
project: Use the root directory of the project.
output-dir
Output directory
lib-dir
HTML library (JS/CSS/etc.) directory
resources
Additional file resources to be copied to output directory
preview
Options for quarto preview (see Preview)
pre-render
Scripts to run as a pre-render step
post-render
Scripts to run as a post-render step
Preview
Specify options that control the behavior of quarto preview within the preview key. For example:
---
project:
type: default
output-dir: _output
preview:
port: 4200
browser: false
---
Available preview options include:
port
Port to listen on (defaults to random value between 3000 and 8000)
host
Hostname to bind to (defaults to 127.0.0.1)
serve
Options for external preview server (see Serve)
browser
Open a web browser to view the preview (defaults to true)
watch-inputs
Re-render input files when they change (defaults to true)
navigate
Navigate the browser automatically when outputs are updated (defaults to true)
timeout
Time (in seconds) after which to exit if there are no active clients
Serve
If you are creating a project extension for another publishing system that includes its own preview server (for example, Hugo or Docusaurus) then use the preview: serve options to customize the behavior of the preview server.
cmd
Serve project preview using the specified command. Interpolate the --port into the command using {port}.
args
Additional command line arguments for preview command.
env
Environment variables to set for preview command.
ready
Regular expression for detecting when the server is ready.
See the Hugo and Docusaurus extension source code for example usages of preview: serve. | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/projects/options.html",
"source": "https://quarto.org/docs/reference/projects/options.html"
} |
OPML (Outline Processor Markup Language) is an XML format for outlines. To learn more about OPML see https://en.wikipedia.org/wiki/OPML.
format: opml
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
order
Order for document when included in a website automatic sidebar menu.
Format Options
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run). | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/reference/formats/opml.html",
"source": "https://quarto.org/docs/reference/formats/opml.html"
} |
Portable Document Format (PDF) is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. To learn more about PDF see https://en.wikipedia.org/wiki/PDF.
See the PDF format user guide for more details on creating PDF output with Quarto.
format: pdf
Title & Author
title
Document title
subtitle
Identifies the subtitle of the document.
date
Document date
author
Author or authors of the document
abstract
Summary of document
thanks
The contents of an acknowledgments footnote after the document title.
order
Order for document when included in a website automatic sidebar menu.
Format Options
pdf-engine
Use the specified engine when producing PDF output. If the engine is not in your PATH, the full path of the engine may be specified here. If this option is not specified, Quarto uses the following defaults depending on the output format in use:
latex: xelatex (other options: pdflatex, lualatex, tectonic, latexmk)
context: context
html: wkhtmltopdf (other options: prince, weasyprint; see print-css.rocks for a good introduction to PDF generation from HTML/CSS.)
ms: pdfroff
pdf-engine-opt
Use the given string as a command-line argument to the pdf-engine. For example, to use a persistent directory foo for latexmk’s auxiliary files, use pdf-engine-opt: -outdir=foo. Note that no check for duplicate options is done.
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
toc-title
The title used for the table of contents.
lof
Print a list of figures in the document.
lot
Print a list of tables in the document.
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-depth
By default, all headings in your document create a numbered section. You customize numbering depth using the number-depth option.
For example, to only number sections immediately below the chapter level, use this:
number-depth: 1
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
top-level-division
Treat top-level headings as the given division type (default, section, chapter, or part). The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type.
The default behavior is to determine the best division type via heuristics: unless other conditions apply, section is chosen. When the documentclass variable is set to report, book, or memoir (unless the article option is specified), chapter is implied as the setting for this option. If beamer is the output format, specifying either chapter or part will cause top-level headings to become \part{..}, while second-level headings remain as their default type.
Fonts
mainfont
For HTML output, sets the CSS font-family on the HTML element.
For LaTeX output, the main font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
For ConTeXt output, the main font family. Use the name of any system font. See ConTeXt Fonts for more information.
monofont
For HTML output, sets the CSS font-family property on code elements.
For PowerPoint output, sets the font used for code.
For LaTeX output, the monospace font family for use with xelatex or lualatex: take the name of any system font, using the fontspec package.
For ConTeXt output, the monspace font family. Use the name of any system font. See ConTeXt Fonts for more information.
fontsize
For HTML output, sets the base CSS font-size property.
For LaTeX and ConTeXt output, sets the font size for the document body text.
fontenc
Allows font encoding to be specified through fontenc package.
See LaTeX Font Encodings Guide for addition information on font encoding.
fontfamily
Font package to use when compiling a PDf with the pdflatex pdf-engine.
See The LaTeX Font Catalogue for a summary of font options available.
For groff (ms) files, the font family for example, T or P.
fontfamilyoptions
Options for the package used as fontfamily.
For example, to use the Libertine font with proportional lowercase (old-style) figures through the libertinus package:
fontfamily: libertinus
fontfamilyoptions:
- osf
- p
sansfont
The sans serif font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
mathfont
The math font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
CJKmainfont
The CJK main font family for use with xelatex or lualatex using the xecjk package.
mainfontoptions
The main font options for use with xelatex or lualatex allowing any options available through fontspec.
For example, to use the TeX Gyre version of Palatino with lowercase figures:
mainfont: TeX Gyre Pagella
mainfontoptions:
- Numbers=Lowercase
- Numbers=Proportional
sansfontoptions
The sans serif font options for use with xelatex or lualatex allowing any options available through fontspec.
monofontoptions
The monospace font options for use with xelatex or lualatex allowing any options available through fontspec.
mathfontoptions
The math font options for use with xelatex or lualatex allowing any options available through fontspec.
CJKoptions
The CJK font options for use with xelatex or lualatex allowing any options available through fontspec.
microtypeoptions
Options to pass to the microtype package.
linestretch
For HTML output sets the CSS line-height property on the html element, which is preferred to be unitless.
For LaTeX output, adjusts line spacing using the setspace package, e.g. 1.25, 1.5.
Colors
linkcolor
For HTML output, sets the CSS color property on all links.
For LaTeX output, The color used for internal links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
For ConTeXt output, sets the color for both external links and links within the document.
filecolor
The color used for external links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
citecolor
The color used for citation links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
urlcolor
The color used for linked URLs using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
toccolor
The color used for links in the Table of Contents using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
colorlinks
Add color to link text, automatically enabled if any of linkcolor, filecolor, citecolor, urlcolor, or toccolor are set.
Layout
cap-location
Where to place figure and table captions (top, bottom, or margin)
fig-cap-location
Where to place figure captions (top, bottom, or margin)
tbl-cap-location
Where to place table captions (top, bottom, or margin)
documentclass
The document class.
classoption
For LaTeX/PDF output, the options set for the document class.
For HTML output using KaTeX, you can render display math equations flush left using classoption: fleqn
pagestyle
Control the \pagestyle{} for the document.
papersize
The paper size for the document.
grid
Properties of the grid system used to layout Quarto HTML pages.
margin-left
For HTML output, sets the margin-left property on the Body element.
For LaTeX output, sets the left margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the left margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the left page margin.
margin-right
For HTML output, sets the margin-right property on the Body element.
For LaTeX output, sets the right margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the right margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the right page margin.
margin-top
For HTML output, sets the margin-top property on the Body element.
For LaTeX output, sets the top margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the top margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the top page margin.
margin-bottom
For HTML output, sets the margin-bottom property on the Body element.
For LaTeX output, sets the bottom margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the bottom margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the bottom page margin.
geometry
Options for the geometry package. For example:
geometry:
- top=30mm
- left=20mm
- heightrounded
hyperrefoptions
Options for the hyperref package. For example:
hyperrefoptions:
- linktoc=all
- pdfwindowui
- pdfpagemode=FullScreen
To customize link colors, please see the Quarto PDF reference.
indent
Whether to use document class settings for indentation. If the document class settings are not used, the default LaTeX template removes indentation and adds space between paragraphs
For groff (ms) documents, the paragraph indent, for example, 2m.
block-headings
Make \paragraph and \subparagraph (fourth- and fifth-level headings, or fifth- and sixth-level with book classes) free-standing rather than run-in; requires further formatting to distinguish from \subsubsection (third- or fourth-level headings). Instead of using this option, KOMA-Script can adjust headings more extensively:
header-includes: |
\RedeclareSectionCommand[
beforeskip=-10pt plus -2pt minus -1pt,
afterskip=1sp plus -1sp minus 1sp,
font=\normalfont\itshape]{paragraph}
\RedeclareSectionCommand[
beforeskip=-10pt plus -2pt minus -1pt,
afterskip=1sp plus -1sp minus 1sp,
font=\normalfont\scshape,
indent=0pt]{subparagraph}
Code
code-line-numbers
Include line numbers in code block output (true or false).
For revealjs output only, you can also specify a string to highlight specific lines (and/or animate between sets of highlighted lines).
Sets of lines are denoted with commas:
3,4,5
1,10,12
Ranges can be denoted with dashes and combined with commas:
1-3,5
5-10,12,14
Finally, animation steps are separated by |:
1-3|1-3,5 first shows 1-3, then 1-3,5
|5|5-10,12 first shows no numbering, then 5, then lines 5-10 and 12
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
code-block-border-left
Specifies to apply a left border on code blocks. Provide a hex color to specify that the border is enabled as well as the color of the border.=
code-block-bg
Specifies to apply a background color on code blocks. Provide a hex color to specify that the background color is enabled as well as the color of the background.
highlight-style
Specifies the coloring style to be used in highlighted source code.
Instead of a STYLE name, a JSON file with extension .theme may be supplied. This will be parsed as a KDE syntax highlighting theme and (if valid) used as the highlighting style.
syntax-definitions
KDE language syntax definition files (XML)
listings
Use the listings package for LaTeX code blocks. The package does not support multi-byte encoding for source code. To handle UTF-8 you would need to use a custom template. This issue is fully documented here: Encoding issue with the listings package
indented-code-classes
Specify classes to use for all indented code blocks
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-align
Figure horizontal alignment (default, left, right, or center)
fig-env
LaTeX environment for figure output
fig-pos
LaTeX figure position arrangement to be used in \begin{figure}[].
Computational figure output that is accompanied by the code that produced it is given a default value of fig-pos="H" (so that the code and figure are not inordinately separated).
If fig-pos is false, then we don’t use any figure position specifier, which is sometimes necessary with custom figure environments (such as sidewaysfigure).
fig-cap-location
Where to place figure captions (top, bottom, or margin)
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
tbl-cap-location
Where to place table captions (top, bottom, or margin)
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
cite-method
Method used to format citations (citeproc, natbib, or biblatex).
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
biblatexoptions
A list of options for BibLaTeX.
natbiboptions
One or more options to provide for natbib when generating a bibliography.
biblio-style
The bibliography style to use (e.g. \bibliographystyle{dinat}) when using natbib or biblatex.
biblio-title
The bibliography title to use when using natbib or biblatex.
biblio-config
Controls whether to output bibliography configuration for natbib or biblatex when cite method is not citeproc.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
link-citations
If true, citations will be hyperlinked to the corresponding bibliography entries (for author-date and numerical styles only). Defaults to false.
link-bibliography
If true, DOIs, PMCIDs, PMID, and URLs in bibliographies will be rendered as hyperlinks. (If an entry contains a DOI, PMCID, PMID, or URL, but none of these fields are rendered by the style, then the title, or in the absence of a title the whole entry, will be hyperlinked.) Defaults to true.
notes-after-punctuation
If true (the default for note styles), Quarto (via Pandoc) will put footnote references or superscripted numerical citations after following punctuation. For example, if the source contains blah blah (jones99?)., the result will look like blah blah.[^1], with the note moved after the period and the space collapsed.
If false, the space will still be collapsed, but the footnote will not be moved after the punctuation. The option may also be used in numerical styles that use superscripts for citation numbers (but for these styles the default is not to move the citation).
Footnotes
links-as-notes
Causes links to be printed as footnotes.
reference-location
Specify location for footnotes. Also controls the location of references, if reference-links is set.
block: Place at end of current top-level block
section: Place at end of current section
margin: Place at the margin
document: Place at end of document
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Metadata
keywords
List of keywords to be included in the document metadata.
subject
The document subject
title-meta
Sets the title metadata for the document
author-meta
Sets the author metadata for the document
date-meta
Sets the date metadata for the document
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
keep-tex
Keep the intermediate tex file used during render.
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Latexmk
latex-auto-mk
Use Quarto’s built-in PDF rendering wrapper (includes support for automatically installing missing LaTeX packages)
latex-auto-install
Enable/disable automatic LaTeX package installation
latex-min-runs
Minimum number of compilation passes.
latex-max-runs
Maximum number of compilation passes.
latex-clean
Clean intermediates after compilation.
latex-makeindex
Program to use for makeindex.
latex-makeindex-opts
Array of command line options for makeindex.
latex-tlmgr-opts
Array of command line options for tlmgr.
latex-output-dir
Output directory for intermediates and PDF.
latex-tinytex
Set to false to prevent an installation of TinyTex from being used to compile PDF documents.
latex-input-paths
Array of paths LaTeX should search for inputs.
Text Output
ascii
Use only ASCII characters in output. Currently supported for XML and HTML formats (which use entities instead of UTF-8 when this option is selected), CommonMark, gfm, and Markdown (which use entities), roff ms (which use hexadecimal escapes), and to a limited degree LaTeX (which uses standard commands for accented characters when possible). roff man output uses ASCII by default. | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/pdf.html",
"source": "https://quarto.org/docs/reference/formats/pdf.html"
} |
Textile is a simple text markup language that makes it easy to structure content for blogs, wikis, and documentation. To learn more about Textile see https://www.promptworks.com/textile.
format: textile
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
order
Order for document when included in a website automatic sidebar menu.
Format Options
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run).
strip-comments
Strip out HTML comments in the Markdown source, rather than passing them on to Markdown, Textile or HTML output as raw HTML. This does not apply to HTML comments inside raw HTML blocks when the markdown_in_html_blocks extension is not set. | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/textile.html",
"source": "https://quarto.org/docs/reference/formats/textile.html"
} |
TEI Simple aims to define a new highly-constrained and prescriptive subset of the Text Encoding Initiative (TEI) Guidelines suited to the representation of early modern and modern books, a formally-defined set of processing rules which permit modern web applications to easily present and analyze the encoded texts, mapping to other ontologies, and processes to describe the encoding status and richness of a TEI digital text. Learn more about TEI at https://github.com/TEIC/TEI-Simple.
format: tei
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
order
Order for document when included in a website automatic sidebar menu.
Format Options
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
top-level-division
Treat top-level headings as the given division type (default, section, chapter, or part). The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type.
The default behavior is to determine the best division type via heuristics: unless other conditions apply, section is chosen. When the documentclass variable is set to report, book, or memoir (unless the article option is specified), chapter is implied as the setting for this option. If beamer is the output format, specifying either chapter or part will cause top-level headings to become \part{..}, while second-level headings remain as their default type.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run). | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/tei.html",
"source": "https://quarto.org/docs/reference/formats/tei.html"
} |
The Groff (GNU troff) manuscript format consists of plain text mixed with formatting commands that produces PostScript, PDF, or HTML. Learn more about Groff at https://www.gnu.org/software/groff/groff.html.
format: ms
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
abstract
Summary of document
order
Order for document when included in a website automatic sidebar menu.
Format Options
pdf-engine
Use the specified engine when producing PDF output. If the engine is not in your PATH, the full path of the engine may be specified here. If this option is not specified, Quarto uses the following defaults depending on the output format in use:
latex: xelatex (other options: pdflatex, lualatex, tectonic, latexmk)
context: context
html: wkhtmltopdf (other options: prince, weasyprint; see print-css.rocks for a good introduction to PDF generation from HTML/CSS.)
ms: pdfroff
pdf-engine-opt
Use the given string as a command-line argument to the pdf-engine. For example, to use a persistent directory foo for latexmk’s auxiliary files, use pdf-engine-opt: -outdir=foo. Note that no check for duplicate options is done.
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Fonts
fontfamily
Font package to use when compiling a PDf with the pdflatex pdf-engine.
See The LaTeX Font Catalogue for a summary of font options available.
For groff (ms) files, the font family for example, T or P.
pointsize
The point size, for example, 10p.
lineheight
The line height, for example, 12p.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
indent
Whether to use document class settings for indentation. If the document class settings are not used, the default LaTeX template removes indentation and adds space between paragraphs
For groff (ms) documents, the paragraph indent, for example, 2m.
Code
code-line-numbers
Include line numbers in code block output (true or false).
For revealjs output only, you can also specify a string to highlight specific lines (and/or animate between sets of highlighted lines).
Sets of lines are denoted with commas:
3,4,5
1,10,12
Ranges can be denoted with dashes and combined with commas:
1-3,5
5-10,12,14
Finally, animation steps are separated by |:
1-3|1-3,5 first shows 1-3, then 1-3,5
|5|5-10,12 first shows no numbering, then 5, then lines 5-10 and 12
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
highlight-style
Specifies the coloring style to be used in highlighted source code.
Instead of a STYLE name, a JSON file with extension .theme may be supplied. This will be parsed as a KDE syntax highlighting theme and (if valid) used as the highlighting style.
syntax-definitions
KDE language syntax definition files (XML)
indented-code-classes
Specify classes to use for all indented code blocks
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run).
ascii
Use only ASCII characters in output. Currently supported for XML and HTML formats (which use entities instead of UTF-8 when this option is selected), CommonMark, gfm, and Markdown (which use entities), roff ms (which use hexadecimal escapes), and to a limited degree LaTeX (which uses standard commands for accented characters when possible). roff man output uses ASCII by default. | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/reference/formats/ms.html",
"source": "https://quarto.org/docs/reference/formats/ms.html"
} |
Beamer is a LaTeX class for producing presentations and slides. To learn more about Beamer see https://ctan.org/pkg/beamer.
See the Beamer format user guide for more details on creating Beamer output with Quarto.
format: beamer
Title & Author
title
Document title
subtitle
Identifies the subtitle of the document.
date
Document date
author
Author or authors of the document
institute
Author affiliations for the presentation.
abstract
Summary of document
thanks
The contents of an acknowledgments footnote after the document title.
order
Order for document when included in a website automatic sidebar menu.
Format Options
theme
Theme name, theme scss file, or a mix of both.
pdf-engine
Use the specified engine when producing PDF output. If the engine is not in your PATH, the full path of the engine may be specified here. If this option is not specified, Quarto uses the following defaults depending on the output format in use:
latex: xelatex (other options: pdflatex, lualatex, tectonic, latexmk)
context: context
html: wkhtmltopdf (other options: prince, weasyprint; see print-css.rocks for a good introduction to PDF generation from HTML/CSS.)
ms: pdfroff
pdf-engine-opt
Use the given string as a command-line argument to the pdf-engine. For example, to use a persistent directory foo for latexmk’s auxiliary files, use pdf-engine-opt: -outdir=foo. Note that no check for duplicate options is done.
beamerarticle
Whether to produce a Beamer article from this presentation.
beameroption
Add an extra Beamer option using \setbeameroption{}.
aspectratio
The aspect ratio for this presentation.
logo
The logo image for slides.
titlegraphic
The image for the title slide.
navigation
Controls navigation symbols for the presentation (empty, frame, vertical, or horizontal)
section-titles
Whether to enable title pages for new sections.
colortheme
The Beamer color theme for this presentation.
fonttheme
The Beamer font theme for this presentation.
innertheme
The Beamer inner theme for this presentation.
outertheme
The Beamer outer theme for this presentation.
themeoptions
Options passed to LaTeX Beamer themes.
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
toc-title
The title used for the table of contents.
lof
Print a list of figures in the document.
lot
Print a list of tables in the document.
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-depth
By default, all headings in your document create a numbered section. You customize numbering depth using the number-depth option.
For example, to only number sections immediately below the chapter level, use this:
number-depth: 1
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
top-level-division
Treat top-level headings as the given division type (default, section, chapter, or part). The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type.
The default behavior is to determine the best division type via heuristics: unless other conditions apply, section is chosen. When the documentclass variable is set to report, book, or memoir (unless the article option is specified), chapter is implied as the setting for this option. If beamer is the output format, specifying either chapter or part will cause top-level headings to become \part{..}, while second-level headings remain as their default type.
Slides
incremental
Make list items in slide shows display incrementally (one by one). The default is for lists to be displayed all at once.
slide-level
Specifies that headings with the specified level create slides. Headings above this level in the hierarchy are used to divide the slide show into sections; headings below this level create subheads within a slide. Valid values are 0-6. If a slide level of 0 is specified, slides will not be split automatically on headings, and horizontal rules must be used to indicate slide boundaries. If a slide level is not specified explicitly, the slide level will be set automatically based on the contents of the document
Fonts
mainfont
For HTML output, sets the CSS font-family on the HTML element.
For LaTeX output, the main font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
For ConTeXt output, the main font family. Use the name of any system font. See ConTeXt Fonts for more information.
monofont
For HTML output, sets the CSS font-family property on code elements.
For PowerPoint output, sets the font used for code.
For LaTeX output, the monospace font family for use with xelatex or lualatex: take the name of any system font, using the fontspec package.
For ConTeXt output, the monspace font family. Use the name of any system font. See ConTeXt Fonts for more information.
fontsize
For HTML output, sets the base CSS font-size property.
For LaTeX and ConTeXt output, sets the font size for the document body text.
fontenc
Allows font encoding to be specified through fontenc package.
See LaTeX Font Encodings Guide for addition information on font encoding.
fontfamily
Font package to use when compiling a PDf with the pdflatex pdf-engine.
See The LaTeX Font Catalogue for a summary of font options available.
For groff (ms) files, the font family for example, T or P.
fontfamilyoptions
Options for the package used as fontfamily.
For example, to use the Libertine font with proportional lowercase (old-style) figures through the libertinus package:
fontfamily: libertinus
fontfamilyoptions:
- osf
- p
sansfont
The sans serif font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
mathfont
The math font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
CJKmainfont
The CJK main font family for use with xelatex or lualatex using the xecjk package.
mainfontoptions
The main font options for use with xelatex or lualatex allowing any options available through fontspec.
For example, to use the TeX Gyre version of Palatino with lowercase figures:
mainfont: TeX Gyre Pagella
mainfontoptions:
- Numbers=Lowercase
- Numbers=Proportional
sansfontoptions
The sans serif font options for use with xelatex or lualatex allowing any options available through fontspec.
monofontoptions
The monospace font options for use with xelatex or lualatex allowing any options available through fontspec.
mathfontoptions
The math font options for use with xelatex or lualatex allowing any options available through fontspec.
CJKoptions
The CJK font options for use with xelatex or lualatex allowing any options available through fontspec.
microtypeoptions
Options to pass to the microtype package.
linestretch
For HTML output sets the CSS line-height property on the html element, which is preferred to be unitless.
For LaTeX output, adjusts line spacing using the setspace package, e.g. 1.25, 1.5.
Colors
linkcolor
For HTML output, sets the CSS color property on all links.
For LaTeX output, The color used for internal links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
For ConTeXt output, sets the color for both external links and links within the document.
filecolor
The color used for external links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
citecolor
The color used for citation links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
urlcolor
The color used for linked URLs using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
toccolor
The color used for links in the Table of Contents using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
colorlinks
Add color to link text, automatically enabled if any of linkcolor, filecolor, citecolor, urlcolor, or toccolor are set.
Layout
cap-location
Where to place figure and table captions (top, bottom, or margin)
fig-cap-location
Where to place figure captions (top, bottom, or margin)
tbl-cap-location
Where to place table captions (top, bottom, or margin)
documentclass
The document class.
classoption
For LaTeX/PDF output, the options set for the document class.
For HTML output using KaTeX, you can render display math equations flush left using classoption: fleqn
pagestyle
Control the \pagestyle{} for the document.
papersize
The paper size for the document.
grid
Properties of the grid system used to layout Quarto HTML pages.
margin-left
For HTML output, sets the margin-left property on the Body element.
For LaTeX output, sets the left margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the left margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the left page margin.
margin-right
For HTML output, sets the margin-right property on the Body element.
For LaTeX output, sets the right margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the right margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the right page margin.
margin-top
For HTML output, sets the margin-top property on the Body element.
For LaTeX output, sets the top margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the top margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the top page margin.
margin-bottom
For HTML output, sets the margin-bottom property on the Body element.
For LaTeX output, sets the bottom margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the bottom margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the bottom page margin.
geometry
Options for the geometry package. For example:
geometry:
- top=30mm
- left=20mm
- heightrounded
hyperrefoptions
Options for the hyperref package. For example:
hyperrefoptions:
- linktoc=all
- pdfwindowui
- pdfpagemode=FullScreen
To customize link colors, please see the Quarto PDF reference.
indent
Whether to use document class settings for indentation. If the document class settings are not used, the default LaTeX template removes indentation and adds space between paragraphs
For groff (ms) documents, the paragraph indent, for example, 2m.
block-headings
Make \paragraph and \subparagraph (fourth- and fifth-level headings, or fifth- and sixth-level with book classes) free-standing rather than run-in; requires further formatting to distinguish from \subsubsection (third- or fourth-level headings). Instead of using this option, KOMA-Script can adjust headings more extensively:
header-includes: |
\RedeclareSectionCommand[
beforeskip=-10pt plus -2pt minus -1pt,
afterskip=1sp plus -1sp minus 1sp,
font=\normalfont\itshape]{paragraph}
\RedeclareSectionCommand[
beforeskip=-10pt plus -2pt minus -1pt,
afterskip=1sp plus -1sp minus 1sp,
font=\normalfont\scshape,
indent=0pt]{subparagraph}
Code
code-line-numbers
Include line numbers in code block output (true or false).
For revealjs output only, you can also specify a string to highlight specific lines (and/or animate between sets of highlighted lines).
Sets of lines are denoted with commas:
3,4,5
1,10,12
Ranges can be denoted with dashes and combined with commas:
1-3,5
5-10,12,14
Finally, animation steps are separated by |:
1-3|1-3,5 first shows 1-3, then 1-3,5
|5|5-10,12 first shows no numbering, then 5, then lines 5-10 and 12
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
code-block-border-left
Specifies to apply a left border on code blocks. Provide a hex color to specify that the border is enabled as well as the color of the border.=
code-block-bg
Specifies to apply a background color on code blocks. Provide a hex color to specify that the background color is enabled as well as the color of the background.
highlight-style
Specifies the coloring style to be used in highlighted source code.
Instead of a STYLE name, a JSON file with extension .theme may be supplied. This will be parsed as a KDE syntax highlighting theme and (if valid) used as the highlighting style.
syntax-definitions
KDE language syntax definition files (XML)
listings
Use the listings package for LaTeX code blocks. The package does not support multi-byte encoding for source code. To handle UTF-8 you would need to use a custom template. This issue is fully documented here: Encoding issue with the listings package
indented-code-classes
Specify classes to use for all indented code blocks
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-align
Figure horizontal alignment (default, left, right, or center)
fig-env
LaTeX environment for figure output
fig-pos
LaTeX figure position arrangement to be used in \begin{figure}[].
Computational figure output that is accompanied by the code that produced it is given a default value of fig-pos="H" (so that the code and figure are not inordinately separated).
If fig-pos is false, then we don’t use any figure position specifier, which is sometimes necessary with custom figure environments (such as sidewaysfigure).
fig-cap-location
Where to place figure captions (top, bottom, or margin)
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
tbl-cap-location
Where to place table captions (top, bottom, or margin)
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
cite-method
Method used to format citations (citeproc, natbib, or biblatex).
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
biblatexoptions
A list of options for BibLaTeX.
natbiboptions
One or more options to provide for natbib when generating a bibliography.
biblio-style
The bibliography style to use (e.g. \bibliographystyle{dinat}) when using natbib or biblatex.
biblio-title
The bibliography title to use when using natbib or biblatex.
biblio-config
Controls whether to output bibliography configuration for natbib or biblatex when cite method is not citeproc.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
link-citations
If true, citations will be hyperlinked to the corresponding bibliography entries (for author-date and numerical styles only). Defaults to false.
link-bibliography
If true, DOIs, PMCIDs, PMID, and URLs in bibliographies will be rendered as hyperlinks. (If an entry contains a DOI, PMCID, PMID, or URL, but none of these fields are rendered by the style, then the title, or in the absence of a title the whole entry, will be hyperlinked.) Defaults to true.
notes-after-punctuation
If true (the default for note styles), Quarto (via Pandoc) will put footnote references or superscripted numerical citations after following punctuation. For example, if the source contains blah blah (jones99?)., the result will look like blah blah.[^1], with the note moved after the period and the space collapsed.
If false, the space will still be collapsed, but the footnote will not be moved after the punctuation. The option may also be used in numerical styles that use superscripts for citation numbers (but for these styles the default is not to move the citation).
Footnotes
links-as-notes
Causes links to be printed as footnotes.
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Metadata
keywords
List of keywords to be included in the document metadata.
subject
The document subject
title-meta
Sets the title metadata for the document
author-meta
Sets the author metadata for the document
date-meta
Sets the date metadata for the document
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
keep-tex
Keep the intermediate tex file used during render.
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Latexmk
latex-auto-mk
Use Quarto’s built-in PDF rendering wrapper (includes support for automatically installing missing LaTeX packages)
latex-auto-install
Enable/disable automatic LaTeX package installation
latex-min-runs
Minimum number of compilation passes.
latex-max-runs
Maximum number of compilation passes.
latex-clean
Clean intermediates after compilation.
latex-makeindex
Program to use for makeindex.
latex-makeindex-opts
Array of command line options for makeindex.
latex-tlmgr-opts
Array of command line options for tlmgr.
latex-output-dir
Output directory for intermediates and PDF.
latex-tinytex
Set to false to prevent an installation of TinyTex from being used to compile PDF documents.
latex-input-paths
Array of paths LaTeX should search for inputs.
Text Output
ascii
Use only ASCII characters in output. Currently supported for XML and HTML formats (which use entities instead of UTF-8 when this option is selected), CommonMark, gfm, and Markdown (which use entities), roff ms (which use hexadecimal escapes), and to a limited degree LaTeX (which uses standard commands for accented characters when possible). roff man output uses ASCII by default. | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/presentations/beamer.html",
"source": "https://quarto.org/docs/reference/formats/presentations/beamer.html"
} |
Revealjs is an open source HTML presentation framework. To learn more about Revealjs see https://revealjs.com/.
See the Revealjs format user guide for more details on creating Revealjs output with Quarto.
format: revealjs
Title & Author
title
Document title
subtitle
Identifies the subtitle of the document.
date
Document date
author
Author or authors of the document
institute
Author affiliations for the presentation.
order
Order for document when included in a website automatic sidebar menu.
Format Options
theme
Theme name, theme scss file, or a mix of both.
css
One or more CSS style sheets.
section-divs
Wrap sections in <section> tags and attach identifiers to the enclosing <section> rather than the heading itself.
identifier-prefix
Specify a prefix to be added to all identifiers and internal links in HTML and DocBook output, and to footnote numbers in Markdown and Haddock output. This is useful for preventing duplicate identifiers when generating fragments to be included in other pages.
email-obfuscation
Specify a method for obfuscating mailto: links in HTML documents.
javascript: Obfuscate links using JavaScript.
references: Obfuscate links by printing their letters as decimal or hexadecimal character references.
none (default): Do not obfuscate links.
html-q-tags
Use <q> tags for quotes in HTML.
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
toc-title
The title used for the table of contents.
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-depth
By default, all headings in your document create a numbered section. You customize numbering depth using the number-depth option.
For example, to only number sections immediately below the chapter level, use this:
number-depth: 1
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Slides
incremental
Make list items in slide shows display incrementally (one by one). The default is for lists to be displayed all at once.
slide-level
Specifies that headings with the specified level create slides. Headings above this level in the hierarchy are used to divide the slide show into sections; headings below this level create subheads within a slide. Valid values are 0-6. If a slide level of 0 is specified, slides will not be split automatically on headings, and horizontal rules must be used to indicate slide boundaries. If a slide level is not specified explicitly, the slide level will be set automatically based on the contents of the document
slide-number
Display the page number of the current slide
true: Show slide number
false: Hide slide number
Can optionally be set as a string that specifies the number formatting:
h.v: Horizontal . vertical slide number
h/v: Horizontal / vertical slide number
c: Flattened slide number
c/t: Flattened slide number / total slides (default)
show-slide-number
Contexts in which the slide number appears (all, print, or speaker)
title-slide-attributes
Additional attributes for the title slide of a reveal.js presentation as a map of attribute names and values. For example
title-slide-attributes:
data-background-image: /path/to/title_image.png
data-background-size: contain
(Note that the data- prefix is required here, as it isn’t added automatically.)
title-slide-style
The title slide style. Use pandoc to select the Pandoc default title slide style.
center-title-slide
Vertical centering of title slide
show-notes
Make speaker notes visible to all viewers
rtl
Change the presentation direction to be RTL
Slide Content
logo
Logo image (placed in bottom right corner of slides)
footer
Footer to include on all slides. Can also be set per-slide by including a div with class .footer on the slide.
scrollable
true to allow content that overflows slides vertically to scroll. This can also be set per-slide by including the .scrollable class on the slide title.
smaller
true to use a smaller default font for slide content. This can also be set per-slide by including the .smaller class on the slide title.
output-location
Location of output relative to the code that generated it. The possible values are as follows:
default: Normal flow of the slide after the code
fragment: In a fragment (not visible until you advance)
slide: On a new slide after the curent one
‘column’: In an adjacent column
column-fragment: In an adjacent column (not visible until you advance)
Note that this option is supported only for the revealjs format.
Slide Tools
overview
Enable the slide overview mode
menu
Configuration for revealjs menu.
chalkboard
Configuration for revealjs chalkboard.
multiplex
Configuration for reveal presentation multiplexing.
Transitions
transition
Transition style for slides backgrounds. (none, fade, slide, convex, concave, or zoom)
transition-speed
Slide transition speed (default, fast, or slow)
background-transition
Transition style for full page slide backgrounds. (none, fade, slide, convex, concave, or zoom)
fragments
Turns fragments on and off globally
auto-animate
Globally enable/disable auto-animate (enabled by default)
auto-animate-easing
Default CSS easing function for auto-animation. Can be overridden per-slide or per-element via attributes.
auto-animate-duration
Duration (in seconds) of auto-animate transition. Can be overridden per-slide or per-element via attributes.
auto-animate-unmatched
Auto-animate unmatched elements. Can be overridden per-slide or per-element via attributes.
auto-animate-styles
CSS properties that can be auto-animated (positional styles like top, left, etc. are always animated).
Navigation
progress
Display a presentation progress bar
history
Push each slide change to the browser history
navigation-mode
Changes the behavior of navigation directions.
linear: Removes the up/down arrows. Left/right arrows step through all slides (both horizontal and vertical).
vertical: Left/right arrow keys step between horizontal slides, up/down arrow keys step between vertical slides. Space key steps through all slides (both horizontal and vertical).
grid: When this is enabled, stepping left/right from a vertical stack to an adjacent vertical stack will land you at the same vertical index.
touch
Enable touch navigation on devices with touch input
keyboard
Enable keyboard shortcuts for navigation
mouse-wheel
Enable slide navigation via mouse wheel
hide-inactive-cursor
Hide cursor if inactive
hide-cursor-time
Time before the cursor is hidden (in ms)
loop
Loop the presentation
shuffle
Randomize the order of slides each time the presentation loads
controls
Show arrow controls for navigating through slides.
true: Always show controls
false: Never show controls
auto (default): Show controls when vertical slides are present or when the deck is embedded in an iframe.
controls-layout
Location for navigation controls (edges or bottom-right)
controls-tutorial
Help the user learn the controls by providing visual hints.
controls-back-arrows
Visibility rule for backwards navigation arrows (faded, hidden, or visible).
auto-slide
Automatically progress all slides at the specified interval
auto-slide-stoppable
Stop auto-sliding after user input
auto-slide-method
Navigation method to use when auto sliding (defaults to navigateNext)
default-timing
Expected average seconds per slide (used by pacing timer in speaker view)
pause
Flags whether it should be possible to pause the presentation (blackout)
help
Show a help overlay when the ? key is pressed
hash
Add the current slide to the URL hash
hash-type
URL hash type (number or title)
hash-one-based-index
Use 1 based indexing for hash links to match slide number
respond-to-hash-changes
Monitor the hash and change slides accordingly
fragment-in-url
Include the current fragment in the URL
slide-tone
Play a subtle sound when changing slides
Print to PDF
pdf-separate-fragments
Prints each fragment on a separate slide
pdf-page-height-offset
Offset used to reduce the height of content within exported PDF pages. This exists to account for environment differences based on how you print to PDF. CLI printing options, like phantomjs and wkpdf, can end on precisely the total height of the document whereas in-browser printing has to end one pixel before.
Media
preview-links
Open links in an iframe preview overlay.
true: Open links in iframe preview overlay
false: Do not open links in iframe preview overlay
auto (default): Open links in iframe preview overlay, in fullscreen mode.
auto-play-media
Autoplay embedded media (null, true, or false). Default is null (only when autoplay attribute is specified)
preload-iframes
Global override for preloading lazy-loaded iframes
null: Iframes with data-src AND data-preload will be loaded when within the viewDistance, iframes with only data-src will be loaded when visible
true: All iframes with data-src will be loaded when within the viewDistance
false: All iframes with data-src will be loaded only when visible
view-distance
Number of slides away from the current slide to pre-load resources for
mobile-view-distance
Number of slides away from the current slide to pre-load resources for (on mobile devices).
parallax-background-image
Parallax background image
parallax-background-size
Parallax background size (e.g. ‘2100px 900px’)
parallax-background-horizontal
Number of pixels to move the parallax background horizontally per slide.
parallax-background-vertical
Number of pixels to move the parallax background vertically per slide.
Slide Layout
auto-stretch
For slides with a single top-level image, automatically stretch it to fill the slide.
width
The “normal” width of the presentation, aspect ratio will be preserved when the presentation is scaled to fit different resolutions. Can be specified using percentage units.
height
The “normal” height of the presentation, aspect ratio will be preserved when the presentation is scaled to fit different resolutions. Can be specified using percentage units.
margin
Factor of the display size that should remain empty around the content
min-scale
Bounds for smallest possible scale to apply to content
max-scale
Bounds for largest possible scale to apply to content
center
Vertical centering of slides
disable-layout
Disables the default reveal.js slide layout (scaling and centering)
Layout
cap-location
Where to place figure and table captions (top, bottom, or margin)
fig-cap-location
Where to place figure captions (top, bottom, or margin)
tbl-cap-location
Where to place table captions (top, bottom, or margin)
classoption
For LaTeX/PDF output, the options set for the document class.
For HTML output using KaTeX, you can render display math equations flush left using classoption: fleqn
grid
Properties of the grid system used to layout Quarto HTML pages.
max-width
Adds a css max-width to the body Element.
margin-left
For HTML output, sets the margin-left property on the Body element.
For LaTeX output, sets the left margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the left margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the left page margin.
margin-right
For HTML output, sets the margin-right property on the Body element.
For LaTeX output, sets the right margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the right margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the right page margin.
margin-top
For HTML output, sets the margin-top property on the Body element.
For LaTeX output, sets the top margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the top margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the top page margin.
margin-bottom
For HTML output, sets the margin-bottom property on the Body element.
For LaTeX output, sets the bottom margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the bottom margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the bottom page margin.
Code
code-fold
Collapse code into an HTML <details> tag so the user can display it on-demand.
true: collapse code
false (default): do not collapse code
show: use the <details> tag, but show the expanded code initially.
code-summary
Summary text to use for code blocks collapsed using code-fold
code-overflow
Choose how to handle code overflow, when code lines are too wide for their container. One of:
scroll
wrap
code-line-numbers
Include line numbers in code block output (true or false).
For revealjs output only, you can also specify a string to highlight specific lines (and/or animate between sets of highlighted lines).
Sets of lines are denoted with commas:
3,4,5
1,10,12
Ranges can be denoted with dashes and combined with commas:
1-3,5
5-10,12,14
Finally, animation steps are separated by |:
1-3|1-3,5 first shows 1-3, then 1-3,5
|5|5-10,12 first shows no numbering, then 5, then lines 5-10 and 12
code-copy
Enable a code copy icon for code blocks.
true: Always show the icon
false: Never show the icon
hover (default): Show the icon when the mouse hovers over the code block
code-link
Enables hyper-linking of functions within code blocks to their online documentation.
Code linking is currently implemented only for the knitr engine (via the downlit package).
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
highlight-style
Specifies the coloring style to be used in highlighted source code.
Instead of a STYLE name, a JSON file with extension .theme may be supplied. This will be parsed as a KDE syntax highlighting theme and (if valid) used as the highlighting style.
syntax-definitions
KDE language syntax definition files (XML)
indented-code-classes
Specify classes to use for all indented code blocks
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-align
Figure horizontal alignment (default, left, right, or center)
fig-cap-location
Where to place figure captions (top, bottom, or margin)
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
fig-responsive
Whether to make images in this document responsive.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
tbl-cap-location
Where to place table captions (top, bottom, or margin)
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
Links
link-external-icon
Show a special icon next to links that leave the current site.
link-external-newwindow
Open external links in a new browser window or tab (rather than navigating the current tab).
link-external-filter
A regular expression that can be used to determine whether a link is an internal link. For example, the following will treat links that start with http://www.quarto.org as internal links (and others will be considered external):
^(?:http:|https:)\/\/www\.quarto\.org\/custom
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citations-hover
Enables a hover popup for citation that shows the reference information.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Footnotes
footnotes-hover
Enables a hover popup for footnotes that shows the footnote contents.
reference-location
Specify location for footnotes. Also controls the location of references, if reference-links is set.
block: Place at end of current top-level block
section: Place at end of current section
margin: Place at the margin
document: Place at end of document
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
resources
Path (or glob) to files to publish with this document.
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Metadata
keywords
List of keywords to be included in the document metadata.
pagetitle
Sets the title metadata for the document
title-prefix
Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the body)
description-meta
Sets the description metadata for the document
author-meta
Sets the author metadata for the document
date-meta
Sets the date metadata for the document
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
embed-resources
Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. The resulting file should be “self-contained,” in the sense that it needs no external files and no net access to be displayed properly by a browser. This option works only with HTML output formats, including html4, html5, html+lhs, html5+lhs, s5, slidy, slideous, dzslides, and revealjs. Scripts, images, and stylesheets at absolute URLs will be downloaded; those at relative URLs will be sought relative to the working directory (if the first source file is local) or relative to the base URL (if the first source file is remote). Elements with the attribute data-external="1" will be left alone; the documents they link to will not be incorporated in the document. Limitation: resources that are loaded dynamically through JavaScript cannot be incorporated; as a result, some advanced features (e.g. zoom or speaker notes) may not work in an offline “self-contained” reveal.js slide show.
self-contained
Produce a standalone HTML file with no external dependencies. Note that this option has been deprecated in favor of embed-resources.
self-contained-math
Embed math libraries (e.g. MathJax) within self-contained output. Note that math libraries are not embedded by default because they are quite large and often time consuming to download.
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
strip-comments
Strip out HTML comments in the Markdown source, rather than passing them on to Markdown, Textile or HTML output as raw HTML. This does not apply to HTML comments inside raw HTML blocks when the markdown_in_html_blocks extension is not set.
ascii
Use only ASCII characters in output. Currently supported for XML and HTML formats (which use entities instead of UTF-8 when this option is selected), CommonMark, gfm, and Markdown (which use entities), roff ms (which use hexadecimal escapes), and to a limited degree LaTeX (which uses standard commands for accented characters when possible). roff man output uses ASCII by default.
Library
reveal-js-url
Directory containing reveal.js files. | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/presentations/revealjs.html",
"source": "https://quarto.org/docs/reference/formats/presentations/revealjs.html"
} |
Context is a system for typesetting documents based on TEX and METAPOST. You can learn more about Context at http://www.pragma-ade.nl/.
format: context
Title & Author
title
Document title
subtitle
Identifies the subtitle of the document.
date
Document date
author
Author or authors of the document
abstract
Summary of document
order
Order for document when included in a website automatic sidebar menu.
Format Options
pdf-engine
Use the specified engine when producing PDF output. If the engine is not in your PATH, the full path of the engine may be specified here. If this option is not specified, Quarto uses the following defaults depending on the output format in use:
latex: xelatex (other options: pdflatex, lualatex, tectonic, latexmk)
context: context
html: wkhtmltopdf (other options: prince, weasyprint; see print-css.rocks for a good introduction to PDF generation from HTML/CSS.)
ms: pdfroff
pdf-engine-opt
Use the given string as a command-line argument to the pdf-engine. For example, to use a persistent directory foo for latexmk’s auxiliary files, use pdf-engine-opt: -outdir=foo. Note that no check for duplicate options is done.
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
pagenumbering
Sets the page numbering style and location for the document using the \setuppagenumbering command.
See ConTeXt Page Numbering for additional information.
top-level-division
Treat top-level headings as the given division type (default, section, chapter, or part). The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type.
The default behavior is to determine the best division type via heuristics: unless other conditions apply, section is chosen. When the documentclass variable is set to report, book, or memoir (unless the article option is specified), chapter is implied as the setting for this option. If beamer is the output format, specifying either chapter or part will cause top-level headings to become \part{..}, while second-level headings remain as their default type.
Fonts
mainfont
For HTML output, sets the CSS font-family on the HTML element.
For LaTeX output, the main font family for use with xelatex or lualatex. Takes the name of any system font, using the fontspec package.
For ConTeXt output, the main font family. Use the name of any system font. See ConTeXt Fonts for more information.
monofont
For HTML output, sets the CSS font-family property on code elements.
For PowerPoint output, sets the font used for code.
For LaTeX output, the monospace font family for use with xelatex or lualatex: take the name of any system font, using the fontspec package.
For ConTeXt output, the monspace font family. Use the name of any system font. See ConTeXt Fonts for more information.
fontsize
For HTML output, sets the base CSS font-size property.
For LaTeX and ConTeXt output, sets the font size for the document body text.
linestretch
For HTML output sets the CSS line-height property on the html element, which is preferred to be unitless.
For LaTeX output, adjusts line spacing using the setspace package, e.g. 1.25, 1.5.
interlinespace
Adjusts line spacing using the \setupinterlinespace command.
linkstyle
The typeface style for links in the document.
whitespace
Set the spacing between paragraphs, for example none, small using the setupwhitespace command.
Colors
linkcolor
For HTML output, sets the CSS color property on all links.
For LaTeX output, The color used for internal links using color options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists.
For ConTeXt output, sets the color for both external links and links within the document.
contrastcolor
Color for links to other content within the document.
See ConTeXt Color for additional information.
Layout
layout
The options for margins and text layout for this document.
See ConTeXt Layout for additional information.
grid
Properties of the grid system used to layout Quarto HTML pages.
margin-left
For HTML output, sets the margin-left property on the Body element.
For LaTeX output, sets the left margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the left margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the left page margin.
margin-right
For HTML output, sets the margin-right property on the Body element.
For LaTeX output, sets the right margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the right margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the right page margin.
margin-top
For HTML output, sets the margin-top property on the Body element.
For LaTeX output, sets the top margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the top margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the top page margin.
margin-bottom
For HTML output, sets the margin-bottom property on the Body element.
For LaTeX output, sets the bottom margin if geometry is not used (otherwise geometry overrides this value)
For ConTeXt output, sets the bottom margin if layout is not used, otherwise layout overrides these.
For wkhtmltopdf sets the bottom page margin.
Formatting
indenting
Set the indentation of paragraphs with one or more options.
See ConTeXt Indentation for additional information.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
headertext
Text to be in a running header.
Provide a single option or up to four options for different placements (odd page inner, odd page outer, even page innner, even page outer).
footertext
Text to be in a running footer.
Provide a single option or up to four options for different placements (odd page inner, odd page outer, even page innner, even page outer).
See ConTeXt Headers and Footers for more information.
includesource
Whether to include all source documents as file attachments in the PDF file.
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Metadata
keywords
List of keywords to be included in the document metadata.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
PDF/A
pdfa
Adds the necessary setup to the document preamble to generate PDF/A of the type specified.
If the value is set to true, 1b:2005 will be used as default.
To successfully generate PDF/A the required ICC color profiles have to be available and the content and all included files (such as images) have to be standard conforming. The ICC profiles and output intent may be specified using the variables pdfaiccprofile and pdfaintent. See also ConTeXt PDFA for more details.
pdfaiccprofile
When used in conjunction with pdfa, specifies the ICC profile to use in the PDF, e.g. default.cmyk.
If left unspecified, sRGB.icc is used as default. May be repeated to include multiple profiles. Note that the profiles have to be available on the system. They can be obtained from ConTeXt ICC Profiles.
pdfaintent
When used in conjunction with pdfa, specifies the output intent for the colors, for example ISO coated v2 300\letterpercent\space (ECI)
If left unspecified, sRGB IEC61966-2.1 is used as default.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run). | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/reference/formats/context.html",
"source": "https://quarto.org/docs/reference/formats/context.html"
} |
Jupyter Notebooks are used to combine software code, computational output, explanatory text and multimedia resources in a single document. Learn more about the Jupyter Notebook format at https://nbformat.readthedocs.io/.
format: ipynb
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
order
Order for document when included in a website automatic sidebar menu.
Format Options
markdown-headings
Specify whether to use atx (#-prefixed) or setext (underlined) headings for level 1 and 2 headings (atx or setext).
ipynb-output
Determines which ipynb cell output formats are rendered.
all: Preserve all of the data formats included in the original.
none: Omit the contents of data cells.
best (default): Instruct pandoc to try to pick the richest data block in each output cell that is compatible with the output format.
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run). | {
"lastmod": "2023-07-05T19:35:15.795Z",
"loc": "https://quarto.org/docs/reference/formats/ipynb.html",
"source": "https://quarto.org/docs/reference/formats/ipynb.html"
} |
XWiki is an open-source enterprise wiki system. To learn more about XWiki see https://www.xwiki.org/.
format: xwiki
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
order
Order for document when included in a website automatic sidebar menu.
Format Options
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run). | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/wiki/xwiki.html",
"source": "https://quarto.org/docs/reference/formats/wiki/xwiki.html"
} |
DokuWiki is a simple to use and highly versatile open source wiki software that doesn’t require a database. To learn more about DokuWiki see https://www.dokuwiki.org.
format: dokuwiki
Title & Author
title
Document title
date
Document date
author
Author or authors of the document
order
Order for document when included in a website automatic sidebar menu.
Format Options
quarto-required
A semver version range describing the supported quarto versions for this document or project.
Examples:
>= 1.1.0: Require at least quarto version 1.1
1.*: Require any quarto versions whose major version number is 1
Table of Contents
toc
Include an automatically generated table of contents (or, in the case of latex, context, docx, odt, opendocument, rst, or ms, an instruction to create one) in the output document. This option has no effect if standalone is false.
Note that if you are producing a PDF via ms, the table of contents will appear at the beginning of the document, before the title. If you would prefer it to be at the end of the document, use the option pdf-engine-opt: --no-toc-relocation.
toc-depth
Specify the number of section levels to include in the table of contents. The default is 3
Numbering
number-sections
Number section headings rendered output. By default, sections are not numbered. Sections with class .unnumbered will never be numbered, even if number-sections is specified.
number-offset
Offset for section headings in output (offsets are 0 by default) The first number is added to the section number for top-level headings, the second for second-level headings, and so on. So, for example, if you want the first top-level heading in your document to be numbered “6”, specify number-offset: 5. If your document starts with a level-2 heading which you want to be numbered “1.5”, specify number-offset: [1,4]. Implies number-sections
shift-heading-level-by
Shift heading levels by a positive or negative integer. For example, with shift-heading-level-by: -1, level 2 headings become level 1 headings, and level 3 headings become level 2 headings. Headings cannot have a level less than 1, so a heading that would be shifted below level 1 becomes a regular paragraph. Exception: with a shift of -N, a level-N heading at the beginning of the document replaces the metadata title.
Layout
grid
Properties of the grid system used to layout Quarto HTML pages.
Code
code-annotations
The style to use when displaying code annotations. Set this value to false to hide code annotations.
Execution
Execution options should be specified within the execute key. For example:
execute:
echo: false
warning: false
eval
Evaluate code cells (if false just echos the code into output).
true (default): evaluate code cell
false: don’t evaluate code cell
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
echo
Include cell source code in rendered output.
true (default): include source code in output
false: do not include source code in output
fenced: in addition to echoing, include the cell delimiter as part of the output.
[...]: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)
output
Include the results of executing the code in the output. Possible values:
true: Include results.
false: Do not include results.
asis: Treat output as raw markdown with no enclosing containers.
warning
Include warnings in rendered output.
error
Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include
Catch all for preventing any output (code or results) from being included in output.
cache
Cache results of computations (using the knitr cache for R documents, and Jupyter Cache for Jupyter documents).
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
true: Cache results
false: Do not cache results
refresh: Force a refresh of the cache even if has not been otherwise invalidated.
freeze
Control the re-use of previous computational output when rendering.
true: Never recompute previously generated computational output during a global project render
false (default): Recompute previously generated computational output
auto: Re-compute previously generated computational output only in case their source file changes
Figures
fig-width
Default width for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-height
Default height for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-format
Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi
Default DPI for figures generated by Matplotlib or R graphics.
Note that with the Jupyter engine, this option has no effect when provided at the cell level; it can only be provided with document or project metadata.
fig-asp
The aspect ratio of the plot, i.e., the ratio of height/width. When fig-asp is specified, the height of a plot (the option fig-height) is calculated from fig-width * fig-asp.
The fig-asp option is only available within the knitr engine.
Tables
tbl-colwidths
Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
Some formats (e.g. HTML) do an excellent job automatically sizing table columns and so don’t benefit much from column width specifications. Other formats (e.g. LaTeX) require table column sizes in order to correctly flow longer cell content (this is a major reason why tables > 72 columns wide are assigned explicit widths by Pandoc).
This can be specified as:
auto: Apply markdown table column widths except when there is a hyperlink in the table (which tends to throw off automatic calculation of column widths based on the markdown text width of cells). (auto is the default for HTML output formats)
true: Always apply markdown table widths (true is the default for all non-HTML formats)
false: Never apply markdown table widths.
An array of numbers (e.g. [40, 30, 30]): Array of explicit width percentages.
df-print
Method used to print tables in Knitr engine documents:
default: Use the default S3 method for the data frame.
kable: Markdown table using the knitr::kable() function.
tibble: Plain text table using the tibble package.
paged: HTML table with paging for row and column overflow.
The default printing method is kable.
References
bibliography
Document bibliography (BibTeX or CSL). May be a single file or a list of files
csl
Citation Style Language file to use for formatting references.
citeproc
Turn on built-in citation processing. To use this feature, you will need to have a document containing citations and a source of bibliographic data: either an external bibliography file or a list of references in the document’s YAML metadata. You can optionally also include a csl citation style file.
citation-abbreviations
JSON file containing abbreviations of journals that should be used in formatted bibliographies when form="short" is specified. The format of the file can be illustrated with an example:
{ "default": {
"container-title": {
"Lloyd's Law Reports": "Lloyd's Rep",
"Estates Gazette": "EG",
"Scots Law Times": "SLT"
}
}
}
Citation
citation
Citation information for the document itself specified as CSL YAML in the document front matter.
For more on supported options, see Citation Metadata.
Language
lang
Identifies the main language of the document using IETF language tags (following the BCP 47 standard), such as en or en-GB. The Language subtag lookup tool can look up or verify these tags.
This affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt.
language
YAML file containing custom language translations
dir
The base script direction for the document (rtl or ltr).
For bidirectional documents, native pandoc spans and divs with the dir attribute can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the [Unicode Bidirectional Algorithm].
When using LaTeX for bidirectional documents, only the xelatex engine is fully supported (use --pdf-engine=xelatex).
Includes
include-before-body
Include contents at the beginning of the document body (e.g. after the <body> tag in HTML, or the \begin{document} command in LaTeX).
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-after-body
Include content at the end of the document body immediately after the markdown content. While it will be included before the closing </body> tag in HTML and the \end{document} command in LaTeX, this option refers to the end of the markdown content.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
include-in-header
Include contents at the end of the header. This can be used, for example, to include special CSS or JavaScript in HTML documents.
A string value or an object with key “file” indicates a filename whose contents are to be included
An object with key “text” indicates textual content to be included
metadata-files
Read metadata from the supplied YAML (or JSON) files. This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown. Generally, the input will be handled the same as in YAML metadata blocks. Values in files specified later in the list will be preferred over those specified earlier. Metadata values specified inside the document, or by using -M, overwrite values specified with this option.
Rendering
from
Format to read from. Extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name (e.g. markdown+emoji).
output-file
Output file to write to
output-ext
Extension to use for generated output file
template
Use the specified file as a custom template for the generated document.
template-partials
Include the specified files as partials accessible to the template for the generated content.
standalone
Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment)
filters
Specify executables or Lua scripts to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written.
shortcodes
Specify Lua scripts that implement shortcode handlers
keep-md
Keep the markdown file generated by executing code
keep-ipynb
Keep the notebook file generated from executing code.
ipynb-filters
Filters to pre-process ipynb files before rendering to markdown
extract-media
Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. Media are downloaded, read from the file system, or extracted from a binary container (e.g. docx), as needed. The original file paths are used if they are relative paths not containing … Otherwise filenames are constructed from the SHA1 hash of the contents.
resource-path
List of paths to search for images and other resources.
default-image-extension
Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.
abbreviations
Specifies a custom abbreviations file, with abbreviations one to a line. This list is used when reading Markdown input: strings found in this list will be followed by a nonbreaking space, and the period will not produce sentence-ending space in formats like LaTeX. The strings may not contain spaces.
dpi
Specify the default dpi (dots per inch) value for conversion from pixels to inch/ centimeters and vice versa. (Technically, the correct term would be ppi: pixels per inch.) The default is 96. When images contain information about dpi internally, the encoded value is used instead of the default specified by this option.
Text Output
wrap
Determine how text is wrapped in the output (the source code, not the rendered version).
auto (default): Pandoc will attempt to wrap lines to the column width specified by columns (default 72).
none: Pandoc will not wrap lines at all.
preserve: Pandoc will attempt to preserve the wrapping from the source document. Where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well.
columns
Specify length of lines in characters. This affects text wrapping in generated source code (see wrap). It also affects calculation of column widths for plain text tables.
tab-stop
Specify the number of spaces per tab (default is 4). Note that tabs within normal textual input are always converted to spaces. Tabs within code are also converted, however this can be disabled with preserve-tabs: false.
preserve-tabs
Preserve tabs within code instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. Tabs in regular text are always treated as spaces.
eol
Manually specify line endings:
crlf: Use Windows line endings
lf: Use macOS/Linux/UNIX line endings
native (default): Use line endings appropriate to the OS on which pandoc is being run). | {
"lastmod": "2023-07-05T19:35:15.799Z",
"loc": "https://quarto.org/docs/reference/formats/wiki/dokuwiki.html",
"source": "https://quarto.org/docs/reference/formats/wiki/dokuwiki.html"
} |