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 &nbsp; 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" }

No dataset card yet

New: Create and edit this dataset card directly on the website!

Contribute a Dataset Card
Downloads last month
15
Add dataset card