Skip to content

TOC depth int bs4_book #1377

@ghost

Description

Hi there,

I am wondering whether there is a way to increase the TOC depth in bs4_book? It looks as if my current toc setting do not have any effect. This is the content of _output.yml

bookdown::bs4_book:
  toc_depth: 6
  theme:
    primary: "#0d6efd"   
       base_font: 
      google: Sen
    heading_font:
      google:
        family: Bitter
        wght: 200
    code_font:
      google: 
        # arguments to sass::font_google() 
        family: DM Mono
        local: false

Activity

cderv

cderv commented on Aug 31, 2022

@cderv
Collaborator

toc_depth is not part of the customization possible for bs4_bookformat. Related issue one year ago: #1254

This is by design for this format as it would be hard to give a nice formatting for more than 3 levels

bookdown/R/bs4_book.R

Lines 134 to 138 in 7ce6dc6

build_toc <- function(output) {
html <- xml2::read_html(output)
main <- xml2::xml_find_first(html, ".//main")
headings <- xml2::xml_find_all(main, ".//h1|.//h2|.//h3")

BTW toc is not a supported argument in bs4_book and setting toc_depth should have thrown an error. I'll fix that.

added a commit that references this issue on Aug 31, 2022
cderv

cderv commented on Aug 31, 2022

@cderv
Collaborator

I am closing and tracking the idea for votes in #1378

Also, it will throw an error in next version of bookdown to set toc_depth so that it is clear that it is not allowed as it does not work.

thank you !

moved this from Backlog to Done in R Markdown Team Projectson Aug 31, 2022
github-actions

github-actions commented on Mar 8, 2023

@github-actions

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

locked as resolved and limited conversation to collaborators on Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cderv

        Issue actions

          TOC depth int bs4_book · Issue #1377 · rstudio/bookdown