Logical control of presence of a tab in quarto document

  Kiến thức lập trình

Trying to control which tabs are available in a quarto document. The following shows what I am attempting but does not work as tabs are not actually created.

---
title: "Tab Test"
format: html
editor: visual
---

```{r}
#| echo: false
#| include: false

# Tab control
Tab1 <- TRUE
Tab2 <- FALSE
Tab3 <- TRUE
```

Start the tabs

## {.tabset .tabset-pills}

<!-- This tab should be available -->

```{r}
#| echo: false
#| eval: !expr Tab1

# Print the tab
cat('### Tab1 n')
```

<!-- This tab should be not be available -->

```{r}
#| echo: false
#| eval: !expr Tab2

# Print the tab
cat('### Tab2 n')
```

<!-- This tab should be available -->

```{r}
#| echo: false 
#| eval: !expr Tab3

# Print the tab 
cat('### Tab3 n')
```

##

This is the output. Seem like maybe the issue is that the ### is not recognized as formatting? In researching this I’ve seen answers using this approach for other issues, so not sure why it won’t work for me.

Tab Test
Start the tabs

### Tab1 
### Tab3 

LEAVE A COMMENT