Quarto - 如何在 HTML 渲染中隐藏标题但保留在 rStudio 文档中

问题描述 投票:0回答:1

希望有人能提供帮助 - 当以四开本渲染为 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()
```
html label r-markdown render quarto
1个回答
0
投票

在要在输出中隐藏的标题后面添加类

.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()
```
© www.soinside.com 2019 - 2024. All rights reserved.