quarto-authoring
Quarto document authoring and markdown conversion.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- quarto-authoring
- license
- MIT
- metadata
- { "author": "Mickaël Canouil (@mcanouil)", "version": "1.4" }
- description
- Quarto document authoring and markdown conversion.
- allowed-tools
- [ "Read", "Edit", "Write", "Bash" ]
- user-invocable
- true
02 资源文件 21
- 参考文档references/callouts.md3.3 KB
- 参考文档references/citations.md4.9 KB
- 参考文档references/code-cells.md7.8 KB
- 参考文档references/conditional-content.md4.7 KB
- 参考文档references/conversion-blogdown.md6.6 KB
- 参考文档references/conversion-bookdown.md5.2 KB
- 参考文档references/conversion-distill.md5.7 KB
- 参考文档references/conversion-jupyter.md1.3 KB
- 参考文档references/conversion-rmarkdown.md5.6 KB
- 参考文档references/conversion-xaringan.md5.5 KB
- 参考文档references/cross-references.md5.8 KB
- 参考文档references/diagrams.md4.8 KB
- 参考文档references/divs-and-spans.md4.4 KB
- 参考文档references/engines.md3.8 KB
- 参考文档references/extensions.md5.6 KB
- 参考文档references/figures.md5.4 KB
- 参考文档references/layout.md6.1 KB
- 参考文档references/markdown-linting.md1.9 KB
- 参考文档references/shortcodes.md5.2 KB
- 参考文档references/tables.md6.5 KB
- 参考文档references/yaml-front-matter.md6.5 KB
03 SKILL.md 正文
Quarto Authoring
This skill is based on Quarto CLI v1.9.36, released 2026-03-19.
When to Use What
Task: Write a new Quarto document Use: Follow "QMD Essentials" below, then see specific reference files
Task: Add cross-references Use: references/cross-references.md
Task: Configure code cells Use: references/code-cells.md
Task: Add figures with captions Use: references/figures.md
Task: Create tables Use: references/tables.md
Task: Add citations and bibliography Use: references/citations.md
Task: Add callout blocks Use: references/callouts.md
Task: Add diagrams (Mermaid, Graphviz) Use: references/diagrams.md
Task: Control page layout Use: references/layout.md
Task: Use shortcodes Use: references/shortcodes.md
Task: Add conditional content Use: references/conditional-content.md
Task: Use divs and spans Use: references/divs-and-spans.md
Task: Configure YAML front matter Use: references/yaml-front-matter.md
Task: Find and use extensions Use: references/extensions.md
Task: Apply markdown linting rules Use: references/markdown-linting.md
Task: Choose or configure a compute engine (knitr, jupyter, julia) Use: references/engines.md
Migration (only when converting an existing project)
Do NOT read these references when writing new Quarto documents. Only read the one matching the source format when the user explicitly asks to convert or migrate an existing project.
- R Markdown (.Rmd) to Quarto: references/conversion-rmarkdown.md
- bookdown project: references/conversion-bookdown.md
- xaringan slides: references/conversion-xaringan.md
- distill article: references/conversion-distill.md
- blogdown site: references/conversion-blogdown.md
- Jupyter notebook (.ipynb) to/from Quarto: references/conversion-jupyter.md
QMD Essentials
Basic Document Structure
---
title: "Document Title"
author: "Author Name"
date: today
format: html
---
Content goes here.
A Quarto document consists of two main parts:
- YAML Front Matter: Metadata and configuration at the top, enclosed by
---. - Markdown Content: Main body using standard markdown syntax.
Divs and Spans
Divs use fenced syntax with three colons:
::: {.class-name}
Content inside the div.
:::
Spans use bracketed syntax:
This is [important text]{.highlight}.
Details: references/divs-and-spans.md
Code Cell Options Syntax
A code cell starts with triple backticks and a language identifier between curly braces. Code cells are code blocks that can be executed to produce output.
Quarto uses the language's comment symbol + | for cell options.
Options use dashes, not dots (e.g., fig-cap not fig.cap).
- R, Python, Julia:
#| - Mermaid:
%%| - Graphviz/DOT:
//|
```{{language}}
#| label: fig-example
#| echo: false
#| fig-cap: "A scatter plot example."
# code that produces a figure
```
Set document-level defaults in YAML front matter:
execute:
echo: false
warning: false
Caching --- critical engine difference: Only suggest #| cache: true for R code cells (knitr engine).
Never suggest it for other language cells --- it does not work and will be silently ignored.
The only correct approach is execute: cache: true in the top-level YAML front matter when using engines other than knitr.
Python/Jupyter requires jupyter-cache (pip install jupyter-cache):
execute:
cache: true
Details: references/code-cells.md
Cross-References
Labels must start with a type prefix.
Reference with @:
- Figure:
fig-prefix, e.g.,#| label: fig-plot→@fig-plot - Table:
tbl-prefix, e.g.,#| label: tbl-data→@tbl-data - Section:
sec-prefix, e.g.,{#sec-intro}→@sec-intro - Equation:
eq-prefix, e.g.,{#eq-model}→@eq-model
```{{language}}
#| label: fig-plot
#| fig-cap: "A caption for the plot."
# code that produces a figure
```
See @fig-plot for the results.
Details: references/cross-references.md
Callout Blocks
Five types: note, warning, important, tip, caution.
::: {.callout-note}
This is a note callout.
:::
::: {.callout-warning}
## Custom Title
This is a warning with a custom title.
:::
Details: references/callouts.md
In the lab's repositories, every block with a type (definition, result, proof, example, exercise, warning, tip, note) goes in the matching div or callout, and a recurring kind with no matching type gets a custom one: shared/writing/quarto-divs-for-typed-content.md.
Figures
{#fig-name fig-alt="Alt text"}
Subfigures:
::: {#fig-group layout-ncol=2}
{#fig-sub1}
{#fig-sub2}
Main caption for the group.
:::
Details: references/figures.md
Tables
::: {#tbl-example}
| Column 1 | Column 2 |
| -------- | -------- |
| Data 1 | Data 2 |
Table caption.
:::
Details: references/tables.md
Citations
According to @smith2020, the results show...
Multiple citations [@smith2020; @jones2021].
Configure in YAML:
bibliography: references.bib
csl: apa.csl
Details: references/citations.md
Common Workflows
Rendering and Previewing Documents
Run standard Quarto CLI commands to render, preview, and inspect documents:
# Render a single document to HTML or PDF
quarto render document.qmd --to html
quarto render document.qmd --to pdf
# Live preview in browser with automatic reload on save
quarto preview document.qmd
# Render the entire project or book
quarto render
# Check Quarto installation, dependencies, and environment
quarto check
Creating an HTML Document
title: "My Report"
author: "Your Name"
date: today
format:
html:
toc: true
code-fold: true
theme: cosmo
Creating a PDF Document
title: "My Report"
format:
pdf:
documentclass: article
papersize: a4
Creating a RevealJS Presentation
---
title: "My Presentation"
format: revealjs
---
## First Slide
Content here.
## Second Slide
More content.
Setting Up a Quarto Project
Create _quarto.yml in the project root:
project:
type: website
website:
title: "My Site"
navbar:
left:
- href: index.qmd
text: Home
- href: about.qmd
text: About
format:
html:
theme: cosmo
Relationship to other skills
This skill covers general Quarto authoring and documents the upstream chunk-option syntax (#| label: fig-..., #| fig-cap: "...") that Quarto itself supports for figure and table captions.
This repo overrides that convention for its own .qmd files: shared/writing/quarto-figure-captions.md requires div syntax (::: {#fig-...} / ::: {#tbl-...}) instead, and that lab-specific rule takes precedence over the chunk-option examples in this skill's references/figures.md and references/tables.md whenever the document under edit belongs to this repo.
For a journal-submission manuscript, shared/writing/manuscript-float-layout.md sets where figures and tables go (after the main text and references, before the supplement), the page break before the supplement, and how captions must paginate and render.
LaTeX math in any document uses the shared semantic macros, not raw LaTeX, wherever a macro names the concept;
use-math-macros is the procedure, including adding a macro when none fits.
Resources
04 同仓库更多 Skills
wrap-up
End-of-session verification and UMS.
workaround-watcher
Watch upstream issue for fix.
wn
→ whats-next.
whats-next
Recommend concrete next step or action.
wait-for-results
Wait for pipeline/CI results.
wai
→ send-notes.