How to change TOC depth in R Bookdown (GitBook)?
Asked Answered
L

1

11

I use GitBook format through R bookdown. I need to use at least four levels in the table of contents (TOC). The default is three. How can I change the depth of TOC?


UPDATE

Now the toc-related contents of my _output.yml file look like this:

bookdown::gitbook:
  config:
    toc_depth: 4
    toc:
      collapse: section
      scroll_highlight: yes
      before: |
        <li><a href="../index.html"><b>Main</b></a></li>
      after: |
        <li><a href="../index.html"><b>Main</b></a></li>

config: toc_depth: 4 does not work.

Latta answered 27/2, 2018 at 12:53 Comment(0)
B
12

Try adding the following to your _output.yml file:

bookdown::gitbook:
    toc_depth: 2
Bauhaus answered 22/4, 2018 at 13:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.