Day 1: Unleashing Literate Programming with Quarto
Introduction
Welcome to Day 1 of our workshop! Today, we embark on an exploration of literate programming through the powerful open-source tool, Quarto. Literate programming is a methodology that integrates code and documentation, allowing for clearer, more maintainable, and more insightful technical writing. By the end of today, you’ll gain hands-on experience with Quarto, learning how to craft high-quality technical documents, build interactive web pages, and create engaging blogs. Our sessions are designed to provide both theoretical knowledge and practical skills, equipping you with the tools to effectively communicate your code and ideas. Let’s dive into the world of literate programming and see how Quarto can transform your documentation practices.
Publishing workflow
The publishing workflow is the process in which external resources are prepared and collated together with the help of an authoring tool and subsequently rendered with a formatting tool to generate a publishable output that can be delivered in various forms. This is visualised by the following figure.
An example of the creation of a personal website. You collect (1) material to publish in your website data, figures, analyses, and results, those resources are put together with (2) an Integrated Development Environment like Visual Studio creating (3) an organised hierarchy of files and text that includes formatting information, then using (4) a formatting tool like Jekyll all the artefacts are combined into (5) a website of html and other files that can be (6) hosted in a web server.
Quarto is a formatting tool
Formatting tools take input artefacts produced by authoring tools and produce publishable formatted output. While many of the authoring tools discussed in the previous section are well-known, there have been many recent developments in formatting tools that deserve to be better known in the academic community as they take opportunities for publishing training material to the next level. In the previous section we described the two paradigms (SISO) and (SIMO). In this section we describe some formatting tools that can be used for the SIMO paradigm.
Quarto supports Single-In-Multi-Out
The creation of research or academic material usually involves the production of slides, documents, posters and other output formats from the same material. There are different paradigms to create publishing material:
- Single-In-Single-Out tools: Specialise in generating one type of output.
- E.g. text documents with Microsoft Word, Libre Office Writer, LaTeX; slide decks with Microsoft PowerPoint, LibreOffice Impress, LaTeX Beamer, Reveal.js, or Google Slides; and posters with Microsoft Publisher, Google Slides, LaTeX, etc.
- Single-In-Multi-Out tools: Can generate multiple types of publication formats from a joint set of input artefacts.
- Multi-In-Multi-Out tools: Can generate multiple types of publication formats by composing input artefacts from different locations.
More recent publishing systems allow the generation of multiple types of publication formats from a joint set of input artefacts. We refer to this paradigm as Single-In-Multi-Out (SIMO). This paradigm offers various benefits, among them: - keeping the artefacts in a single, well-defined location which facilitates consistency, management and findability; - keeping a unique source of history changes and versions which is useful for auditing and transparency; and - not duplicating artefacts that are not changed between different publishing systems.
Nowadays, the SIMO type of formatting tool is becoming more common, and we focus on the state-of-the-art formatting tools that fall into this category in this roadmap. The roadmap document itself is an example of one particular tool (Jupyter Book
), while the rest of the document and use cases also include examples built with Quarto
. A description of these and other publishing tools is provided with more detail in the next section .
Available for multiple OS
Using quarto
$ quarto --help
render [input] [args...] - Render files or projects to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create [type] [commands...] - Create a Quarto project or extension
use <type> [target] - Automate document or project setup tasks.
add <extension> - Add an extension to this folder or project
update [target...] - Updates an extension or global dependency.
remove [target...] - Removes an extension.
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
typst [args...] - Run the version of Typst embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
install [target...] - Installs a global dependency (TinyTex or Chromium).
uninstall [tool] - Removes an extension.
tools - Display the status of Quarto installed dependencies
publish [provider] [path] - Publish a document or project to a provider.
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
Getting started
- Get started documentation: quarto.org/docs/get-started/
- Open-source repository in GitHub: Quarto-cli
- Create a project with
quarto create project
- Type: default, website, blog, manuscript, book, confluence
- Build project with
quarto render
- Preview with
quarto preview
(it autobuilds and updates when changes in the source files are detected).
Then, what is Quarto?
Quarto is an open-source publishing system with the objective of facilitating the creation of scientific content. Quarto is sponsored by Posit, and follows the development of the R Markdown publishing system extending the focus from the programming language R to Python, Julia and Observable. It supports Jupyter notebooks, markdown and their own extension Quarto
markdown. The conversion to different output formats is done with pandoc, which is able to produce presentations (Reveal.js), dashboards, websites, blogs, books, PDFs, Microsoft Word, ePub and more. Quarto is integrated into multiple authoring environments like Microsoft Visual Studio, Jupyter Lab, Rstudio, and Atlassian Confluence among others.
Key points about Quarto
Quarto
is a formatting tool- uses pandoc to convert the input artefacts to various outputs.
- supports plain text markdown, Jupyter notebooks and an augmented markdown,
- supports dynamic content with Python, R, Julia and Observable programming languages.
- is integrated in multiple IDEs: Visual Studio, Posit Connect (former RMarkdown), Atlassian Confluence, …