Include table of contents in flexdashboard

2020-06-27 00:46发布

I would like to include a table of contents in my flexdashboard document.

Exactly like the table of contents we can see in the documentation : http://rmarkdown.rstudio.com/flexdashboard/using.html

I have tried to add toc:true as in a classical RMarkdown document but it does not seem to work.

---
title: "Reporting"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
    toc: true
---


# Page1

Row
-----------------------------------------------------------------------

## chap1

### chart 1

```{r cars1, echo=FALSE}
plot(pressure)
```


### chart 2
```{r cars2, echo=FALSE}
plot(pressure)
```

Row
-----------------------------------------------------------------------

## chap2

### chart 3
```{r pressure, echo=FALSE}
plot(pressure)
```

# Page 2

Row
-----------------------------------------------------------------------

### p2 chap 1
```{r test}
plot(pressure)
```


Row
-----------------------------------------------------------------------
### p2 graph2

```{r test2, echo=FALSE}
plot(pressure)
```

In this example, I would like to see in Page 1 a table of contents containing two lines : chap1 and chap2. In Page 2 I don't need a table of contents.

How can I do that ?

Thank you.

0条回答
登录 后发表回答