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

クローズ
#1,001 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #1045 @cscheid による — マージ済み

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
r, rust
領域
tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
293
フォーク
20
平均マージ
12時間 21分
マージ済み PR(30日)
178

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/q2 のほかの issue

quarto-dev/q2 の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。