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

Abierto
#1,001 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
r, rust
Área
tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
293
Forks
20
Merge medio
13 h 28 min
PR fusionados (30 d)
163

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/q2

Todos los issues de quarto-dev/q2

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.