This document provides a high-level introduction to the Quarto CLI system, explaining its purpose as a scientific and technical document publishing system and outlining the major architectural components and how they interact. For detailed information about specific subsystems, see:
Quarto is an open-source scientific and technical publishing system built on Pandoc. It transforms source documents—including Quarto markdown (.qmd), Jupyter notebooks (.ipynb), and R Markdown (.Rmd) files—into publication-ready outputs in a variety of formats such as HTML, PDF, EPUB, and RevealJS presentations. README.md10
Key capabilities include:
The system is implemented in TypeScript for the Deno runtime and orchestrates external binaries including Pandoc and Typst. src/quarto.ts129-134
Sources: README.md10-24 src/quarto.ts122-140
Quarto CLI is organized into layered subsystems centered around command processing, document execution, rendering, and output generation. The system is built on Deno and uses a monkey-patching approach for path handling early in the lifecycle. src/quarto.ts7-9
| Component | Description | Code Location |
|---|---|---|
| CLI Entry Point | The main function quarto() responsible for CLI initialization, argument parsing, and dispatch. | src/quarto.ts src/quarto.ts122 |
| Command Registry | Collection of available CLI commands (render, preview, serve, etc.). | src/command/command.ts src/command/command.ts35 |
| Project System | Handles registration and management of project types (websites, books, etc.). | src/project/types/register.ts src/quarto.ts49-50 |
| Language Handlers | Discovery and management of computational language backends. | src/core/handlers/handlers.ts src/quarto.ts46-47 |
| Format Registry | Registration of writer formats and output targets. | src/format/imports.ts src/quarto.ts52-53 |
| Binary Passthrough | Logic for directly invoking bundled binaries like Pandoc and Typst. | src/quarto.ts src/quarto.ts85-120 |
| Logging & Console | System for progress bars, spinners, and multi-level logging. | src/core/log.ts, src/core/console.ts |
Sources: src/quarto.ts43-56 src/quarto.ts122-140 src/command/command.ts35-63
This diagram links conceptual subsystems of Quarto to their primary codebase entities.
Sources: src/quarto.ts122-126 src/command/command.ts35 src/command/run/run.ts14 src/core/log.ts49 src/core/console.ts90 src/execute/jupyter/jupyter-kernel.ts59
Quarto CLI uses the cliffy framework to define its command structure. The entry point handles environment setup, version checks, and reconfigurations before dispatching to specific command handlers. src/quarto.ts170-184
| Command | Handler | Description |
|---|---|---|
render | renderCommand | Renders documents or projects. src/command/command.ts38 |
preview | previewCommand | Live preview with hot-reloading. src/command/command.ts39 |
serve | serveCommand | Serves projects over HTTP. src/command/command.ts40 |
create | createCommand | Creates new projects or documents. src/command/command.ts41 |
run | runCommand | Runs TypeScript, R, Python, or Lua scripts. src/command/run/run.ts48-49 |
inspect | inspectCommand | Emits project/input metadata as JSON. src/command/inspect/cmd.ts16-24 |
publish | publishCommand | Deploys documents/projects to hosting providers. src/command/command.ts55 |
cliffy parses the arguments and executes the registered action. src/quarto.ts194-195Sources: src/quarto.ts122-218 src/command/command.ts35-63 src/command/inspect/cmd.ts16-24
The processing pipeline is the sequence of transformations that turn source markdown into a final format. While detailed in child pages, the high-level flow involves:
executeKernelKeepalive for persistent sessions. src/execute/jupyter/jupyter-kernel.ts59-149For details, see Document Processing Pipeline.
Quarto CLI is a modular system that orchestrates complex document transformations by bridging high-level project management with low-level AST manipulation. It provides a type-safe, schema-driven environment for technical publishing while maintaining deep integration with computational data science ecosystems like Jupyter and Knitr.
Sources: src/quarto.ts1-60 README.md10-24 src/execute/jupyter/jupyter-kernel.ts34-57
Refresh this wiki
This wiki was recently refreshed. Please wait 6 days to refresh again.