Skip to content

inst/examples/css/toc.css fails with (at least) theme 'united' in html_book #1268

Closed
@florisvdh

Description

@florisvdh

I've been using inst/examples/css/toc.css with the united theme, as recommended in:

The TOC is often used for navigation purposes. In the GitBook style, the TOC is displayed in the sidebar. For the Bootstrap style, we did not apply a special style to it, so it is shown as a plain unordered list (in the HTML tag `<ul>`). It is easy to turn this list into a navigation bar with some CSS techniques. We have provided a CSS file `toc.css` in this package that you can use, and you can find it here: https://github.com/rstudio/bookdown/blob/master/inst/examples/css/toc.css

This is the relevant part of the YAML header, and it used to work well several years ago:

output:
  bookdown::html_book:
    theme: united
    split_by: "rmd"
    keep_md: yes
    toc: yes
    css: toc.css

However rerunning this code currently fails to give a satisfactory result: all TOC (sub)sections are now expanded as rectangles under one another, instead of a proper navigation bar.

> xfun::session_info('bookdown')
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20, RStudio 1.4.1717

Locale:
  LC_CTYPE=nl_BE.UTF-8       LC_NUMERIC=C               LC_TIME=nl_BE.UTF-8       
  LC_COLLATE=nl_BE.UTF-8     LC_MONETARY=nl_BE.UTF-8    LC_MESSAGES=nl_BE.UTF-8   
  LC_PAPER=nl_BE.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
  LC_TELEPHONE=C             LC_MEASUREMENT=nl_BE.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3 bookdown_0.24   digest_0.6.28   evaluate_0.14   fastmap_1.1.0  
  glue_1.4.2      graphics_4.1.1  grDevices_4.1.1 highr_0.9       htmltools_0.5.2
  jquerylib_0.1.4 jsonlite_1.7.2  knitr_1.36      magrittr_2.0.1  methods_4.1.1  
  rlang_0.4.11    rmarkdown_2.11  stats_4.1.1     stringi_1.7.5   stringr_1.4.0  
  tinytex_0.34    tools_4.1.1     utils_4.1.1     xfun_0.26       yaml_2.2.1

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • formatted your issue so it is easier for us to read?

  • included a minimal, self-contained, and reproducible example?

  • pasted the output from xfun::session_info('bookdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the bookdown package using remotes::install_github("rstudio/bookdown") ?

-->

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorpandocconcerns upstream pandoc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions