Rmarkdown: Indentation of TOC items in HTML output

Viewed 2084

I want to indent TOC according to header level.

My example document looks like this:

# Tutorial
## Start a new project
### Project structure
### Analysis code

I'm compiling Rmd document with:

rmarkdown::render("foo.Rmd", 
                  output_options = HTMLlook, 
                  output_file = "foo.html")

HTMLlook <- list(toc = TRUE,
                 toc_depth = 5,
                 toc_float = list(collapsed = FALSE, 
                                  smooth_scroll = TRUE))

This produces document with TOC

enter image description here

However, I want indented TOC (indentation equivalent to header level). Wanted result should look like this: enter image description here

Is it possible to set this option in render or maybe pass css parameters to it?

1 Answers
Related