quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.99k stars 328 forks source link

Improve linting to show that `out-width` and `out-height` are being ignored in revealjs when stretch is activated (globally or per slide) #9512

Open EmilHvitfeldt opened 7 months ago

EmilHvitfeldt commented 7 months ago

Bug description

using out-width and out-height in chunks in revealjs documents appears to be ignored.

Steps to reproduce

---
format: revealjs
---

## out-width: 1000px

```{r}
#| out-width: 1000px
library(ggplot2)

ggplot(mpg, aes(displ, hwy, colour = class)) + 
  geom_point()

out-width: 100px

#| out-width: 100px
library(ggplot2)

ggplot(mpg, aes(displ, hwy, colour = class)) + 
  geom_point()

### Expected behavior

I expected the figure would change the output of the figure files

### Actual behavior

they appear unchanged

<img width="863" alt="Screenshot 2024-04-27 at 8 43 33 PM" src="https://github.com/quarto-dev/quarto-cli/assets/14034784/cd799768-6902-466f-af8b-f4424e2cafca">
<img width="865" alt="Screenshot 2024-04-27 at 8 43 40 PM" src="https://github.com/quarto-dev/quarto-cli/assets/14034784/22056916-e4a2-4a6a-961d-02625b54bfbc">

### Your environment

- IDE: RStudio  2023.12.0+359 
- OS: Sonoma 14.4.1 (23E224)

### Quarto check output

```bash
Quarto 1.4.553
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.553
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2021.12
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/emilhvitfeldt/Library/TinyTeX/bin/universal-darwin
      Version: 2021

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.7
      Path: /Users/emilhvitfeldt/.pyenv/versions/3.11.7/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/emilhvitfeldt/Library/R/arm64/4.3/library
        - /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
      knitr: 1.45
      rmarkdown: 2.26

[✓] Checking Knitr engine render......OK
mcanouil commented 7 months ago

This is because by default images are stretched, see https://quarto.org/docs/presentations/revealjs/advanced.html#stretch.

---
format: revealjs
---

## out-width: 1000px {.nostretch}

```{r}
#| label: code
#| out-width: 1000px
library(ggplot2)

ggplot(mpg, aes(displ, hwy, colour = class)) + 
  geom_point()

out-width: 100px {.nostretch}

#| ref-label: code
#| out-width: 100px
cscheid commented 7 months ago

It would be great for us to be able to detect this and issue a warning in our linter.