在夸托revealjs中换行水平代码溢出

nhaq1z21  于 2023-06-19  发布在  其他
关注(0)|答案(1)|浏览(84)

有没有一种方法可以将长行代码 Package 在夸托中,revealjs输出?code-overflow: wrap,适用于html输出,但在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.

![](https://i.stack.imgur.com/FKigp.png)
f8rj6qna

f8rj6qna1#

您可以使用width.cutoff属性(只有在通过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)))

![](https://i.stack.imgur.com/axA4H.png)

相关问题