quarto-dev / quarto-dev/quarto-cli

Document unsupported knitr chunk options

Open
#3,371 8 comments 0 reactions 1 assignee View on GitHub

@cwickham is already working on this.

Since Mar 22, 2023.

documentation lint
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Where should we set knitr chunk options in YAML? The original proposal from Max was:

format:
  html:
    fig-width: 6
    fig-height: 4.25
    fig-align: center

or

knitr:
  opts_chunk:
    fig-width: 6
    fig-height: 4.25
    fig-align: center

More comments from him:

Any recommendation? Are there certain options that should go in one place or another?

Also, I have the equivalent of _common.R. I’d like to specific device settings there using knitr::opts_chunk$set(blah blah blah)
Does that work too? I’d use this to alter options based on the target format (i.e. HTML versus LaTeX).

It looks like dev shouldn't be set in _quarto.yml (and is silently ignored). I set dev: svg for HTML format and it tried to use png.

My understanding is that some of them can be set under execute in the YAML: https://quarto.org/docs/reference/formats/html.html#execution.

And some under knitr: https://quarto.org/docs/reference/cells/cells-knitr.html

And I think instead of dev it's fig-format?
I'm also curious about the "right" answer to this.
And I'm fairly certain you can use knitr::opts_chunk$set(blah blah blah).

I (@allenmanning) answered:

you can use the R code version. also yes its fig-format. The format: html is for universally supported quarto options (i.e. stuff that works in jupyter and knitr). we've attempted to support as much as possible in both but knitr still has a lot of things that jupyter doesn't (thus the opts_chunk failsafe). So I'd say that the correct/recommended approach is to use the universal options (fig-format, execute: echo, etc.) and then only use the opts_chunk for things that are unsupported with the normal syntax

Is there a list of the unsupported options?

we don't currently

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.