knitr: fig-width, fig-height and fig-format are silently ignored outside execute: and cell options

Aperta
#1,001 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
r, rust
Ambito
tooling

Direzione di ricerca

Start in crates/quarto-core/src/engine/knitr/mod.rs at build_format_config, which calls overlay_document_scope in engine/knitr/format.rs. Reproduce with the header example and confirm that fig-width is dropped at top level. Maintainers must first decide whether to honor these keys or warn on them, so ask before coding. Done means the chosen behavior holds for top-level and format: html: placements, and docs/guides/authoring/figures.qmd matches it.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Problem

fig-width, fig-height and fig-format are silently ignored for knitr documents unless they are under execute: or set on the cell. No warning is emitted, so the figure simply comes out at the defaults (7×5 in, 672×480 px PNG).

docs/guides/authoring/figures.qmd previously told readers to set fig-width and fig-height "in the document header", which leads straight to this.

Reproduction

---
title: t
fig-width: 9
fig-height: 4
fig-format: svg
---

```{r}
plot(1:3)
```

q2 render exits 0 with no warning and produces a 672×480 PNG instead of an SVG.

Results by placement

Tested with q2 0.39.0 and R 4.6.0 on macOS:

Where the options go Result
Top level of the header ignored, no warning
format: html: ignored, no warning
execute: works
Cell #| comments works

Cause

The knitr engine only overlays the execute: scope onto its defaults (build_format_config in crates/quarto-core/src/engine/knitr/mod.rs, which calls overlay_document_scope in engine/knitr/format.rs).

Only knitr was tested; Jupyter's behavior is unknown.

Decision needed

Either honor these options at the top level and under format: <fmt>:, or warn when they appear there.

The docs passage has been corrected locally (not yet committed) to describe the execute: form and to state that the other placements have no effect. That wording would need to change if the options become honored.

Lingua principale
Rust
Stelle
283
Fork
20
Merge medio
19h 33m
PR unite (30g)
165

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quarto-dev/q2

Tutte le issue di quarto-dev/q2

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.