希望有人能提供帮助 - 当以四开本渲染为 HTML 时(大概在 Rmarkdown 中也是如此),我经常希望在没有任何设置代码块证据的情况下渲染文档(例如加载库、加载数据、数据操作等),尽管您可以使用 echo=false 或 include=false 隐藏输出,您仍然可以在渲染的 HTML 中获得标题,而下面没有任何内容。我仍然想保留 rstudio 中的标题,因为它们在 rstudio 的“大纲”部分中非常有用,可以在各部分之间快速跳转。尽管 YAML 的格式未通过,但仍可快速表示如下。屏幕截图包括渲染的 HTML 和我试图保留的 rstudio 中的“大纲”部分。非常感谢
---
title: "test"
format: html
editor: visual
editor_options:
chunk_output_type: console
---
# "Setup" - I want this label hidden in my output
```{r echo=FALSE}
library(tidyverse)
```
# "Graph" - I want to keep this label in my output
```{r}
mtcars %>%
ggplot(aes(cyl, mpg)) +
geom_point()
```
在要在输出中隐藏的标题后面添加类
.hidden
。
文档.qmd
---
title: "test"
format: html
editor: visual
editor_options:
chunk_output_type: console
---
# Setup {.hidden}
```{r echo=FALSE}
library(tidyverse)
```
# Graph
```{r}
mtcars %>%
ggplot(aes(cyl, mpg)) +
geom_point()
```