When I add the following lines to add table of content to a shiny document:
toc: true
toc_float: true
The document fails to run. It runs fine without them. I get the following error:
Error Scanner error: mapping values are not allowed in this context at line 5, column 8
(line 5 is toc: true
)
How can I resolve this issue?
The code I ran:
---
title: "Untitled"
runtime: shiny
output:
html_document
toc: true
toc_float: true
---
### section 1
```{r, echo=FALSE}
sliderInput("slider", "Number of observations:", 1, 100, 50)
renderText({paste0(rep('blah', 100), collapse = '\n')})
```
### section 2
```{r, echo=FALSE}
renderPlot({hist(rnorm(500)[seq_len(input$slider)])})
```
CodePudding user response:
You're just missing a : from html_document
. It should be html_document:
---
title: "Untitled"
runtime: shiny
output:
html_document:
toc: true
toc_float: true
---