quarto-dev / quarto-dev/quarto-cli

chunk options conditional to output format ?

Open
#2,416 7 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Sep 14, 2022.

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

Description

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/2411

Originally posted by shabbychef September 12, 2022
Hi,
I think in quarto I can set default options in the header YAML via something like:

format:
  html:
    out-width: "625px"
    out-height: "402px"
    fig-format: png
    fig-width: 10.0
    fig-height: 6.43
  pdf:
    fig-width: 11.5
    fig-height: 6.8

Is it possible to override these in a chunk in a way that is by output type? It seems that I can only override these options absolutely, and not conditionally on the output type.

thanks,

This was also tried

```{r 'plot_foo'}
#| html: out-width: "625px"
#| html: out-height: "402px"
#| pdf: out-width: "\\textwidth"
#| pdf: out-height: "0.64\textwidth"
```

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.