Skip to content

[FR] Support TOC depth customization in bs4_book #1378

Open
@cderv

Description

@cderv

Two issue has been opened on this already

TOC in bs4_book() is not either opt-out or allowing customization. Max level of TOC is h3

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")

This is by design so that we get a nice styling to the specific TOC (it is not the same toc float as in rmarkdown::html_document)
Doing more levels would require probably some adjustment on styling, and allowing any number of levels does not seem a good choice as the TOC would be cluttered.

Opening this issue to track interest by vote with 👍 for TOC depth customization in bs4_book as it can be reconsidered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions