VS Code extension for the Quarto scientific and technical publishing system. This extension provides language support for Quarto
The easiest way to install is directly from within VS Code (search extensions for "quarto").
Render and Preview
The Quarto VS Code extension includes commands and keyboard shortcuts for rendering Quarto documents (both standalone and within websites or books). After rendering,
To render and preview, execute the Quarto: Preview command. You can alternatively use the Ctrl+Shift+K keyboard shortcut, or the Preview button at the top right of the editor:
The Quarto: Preview command renders the default format of the currently active document. If you want to preview a different format, use the Quarto: Preview Format command:
When you execute Preview Format, you'll see a quick pick list of formats to choose from (any formats declared in the document as well as some standard formats like PDF and MS Word):
After previewing a different format, the Quarto: Preview command and Ctrl+Shift+K keyboard shortcut will be automatically rebound to the newly selected format for the duration of the current preview. To switch back to previewing the original format, use Quarto: Preview Format command again.
The Quarto: Preview command is what you will most commonly use while authoring documents. If you have a single format (e.g. HTML or PDF) then previewing also renders your document so it's ready for distribution once you are happy with the output. However, if you have multiple formats will need to explicitly render them (as preview only renders a single format at a time). You can do this with the Quarto: Render command:
Render on Save
By default Quarto does not automatically render
However, you can configure the Quarto extension to automatically render whenever you save. You can do this either within VS Code settings or within the YAML options for your project or document. To configure the VS Code setting, search for
You might also want to control this behavior on a per-document or per-project basis. If you include the
If you prefer to use an external browser for preview (or have no preview triggered at all by rendering) you can use the Preview Type option to specify an alternate behavior:
There are a variety of tools that make it easier to edit and execute code cells. Editing tools include syntax highlighting, code folding, code completion, and signature tips:
For Python, R, and Julia cells, commands are available to execute the current cell, previous cells, or the currently selected line(s). Cell output is shown side by side in the Jupyter interactive console:
Execute the current cell with
Enhanced features for embedded languages (e.g. completion, code execution) can be enabled by installing the most recent version(s) of these extensions:
Note that you can quickly insert a new code cell using the
Execute the Quarto: Show Assist Panel command to show a panel in the sidebar that shows contextual assistance depending on the current cursor location:
For example, below help on the matplotlib
While editing LaTeX math or Mermaid and Graphviz diagrams, click the Preview button above the code to open a live preview which will update automatically as you edit.
Here we see a preview of the currently edited LaTeX equation displayed in the Quarto assist panel:
Here we see a Graphviz diagram preview automatically updated as we edit:
YAML code completion is available for project files, YAML front matter, and executable cell options:
If you have incorrect YAML it will also be highlighted when documents are saved:
Note that YAML intelligence features require version 0.9.44 or later of the Quarto CLI.
Code snippets are templates that make it easier to enter repeating code patterns (e.g. code blocks, callouts, divs, etc.). Execute the Insert Snippet command within a Quarto document to insert a markdown snippet:
If you have a large document use the outline view for quick navigation between sections:
You can also use the
In addition to editing Quarto document as plain-text
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 call to Raw using the cell type menu at the bottom right of the cell:
Here’s the underlying code for the markdown cell:
Note that a Quarto cross-reference (
Quarto uses leading comments with a special prefix (
Note that options must appear at the very beginning of the cell. As with document front-matter, option names/values use YAML syntax.