0

Is there a way to have long lines of code wrapped in Quarto, revealjs output? code-overflow: wrap, which works for html output does not seem to work in revealjs:

---
format: revealjs
---

## A title

```{r}
#| echo: true
#| code-overflow: wrap
multipoint <- sf::st_multipoint(rbind(c(3.2,4), c(3,4.6), c(3.8,4.4), c(3.5,3.8), c(3.4,3.6), c(3.9,4.5)))
#This should be wrapped.
```

enter image description here

Maël
  • 45,206
  • 3
  • 29
  • 67

1 Answers1

2

You can use the width.cutoff property (only a viable option if you render via knitr):

---
format: revealjs
---

## A title


Here is some example code

```{r}
#| eval: false
#| echo: true
#| tidy: true
#| tidy.opts: { width.cutoff: 60 }
multipoint <- sf::st_multipoint(rbind(c(3.2,4), c(3,4.6), c(3.8,4.4), c(3.5,3.8), c(3.4,3.6), c(3.9,4.5)))
```

enter image description here

Julian
  • 6,586
  • 2
  • 9
  • 33
  • 1
    This works, thanks! Note that adding `width.cutoff` as an option with the hash pipe `#|` does not seem to be supported yet, weirdly enough... – Maël Jun 05 '23 at 13:13
  • 1
    Yes, I do not find a way either..if you want to follow up on this, I created a question in [quarto discussion](https://github.com/quarto-dev/quarto-cli/discussions/5813). – Julian Jun 05 '23 at 13:15
  • 2
    Just one thing, this probably would not work with `jupyter` engine or any engine other than `knitr`. – shafee Jun 05 '23 at 13:38
  • 1
    `#| tidy.opts: { width.cutoff: 60 }` works @Maël – Julian Jun 05 '23 at 14:16