Does anyone have a way in a floating table of contents in an R markdown html document to create a button in the table of contents to collapse 3rd or 2nd level outcome headings? I use 3rd level subheadings for figure descriptions so that I get an automatic "table of figures" inside the TOC but sometimes don't want to see them when there are many figures.
I want to have toc_depth=3
in the yaml
header and have the floating TOC initially open with all three levels shown, but have the option to click somewhere so that only 2 levels are shown in the TOC. Ideally it would be nice to also be able to display only one level, and to selectively expand a specific top-level heading to include second level headings (then third level, etc.).
toc_depth: 2
in the YAML header of the .Rmd file is NOT what you are after? – markdly