Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hidingTOC

Moving and Hiding Table of Contents


Description

Moving and hiding table of contents for Rmd HTML documents

Usage

hidingTOC(
  buttonLabel = "Contents",
  levels = 3,
  tocSide = c("right", "left"),
  buttonSide = c("right", "left"),
  posCollapse = c("margin", "top", "bottom"),
  hidden = FALSE
)

Arguments

buttonLabel

the text on the button that hides and unhides the table of contents. Defaults to Contents.

levels

the max depth of the table of contents that it is desired to have control over the display of. (defaults to 3)

tocSide

which side of the page should the table of contents be placed on. Can be either 'right' or 'left'. Defaults to 'right'

buttonSide

which side of the page should the button that hides the TOC be placed on. Can be either 'right' or 'left'. Defaults to 'right'

posCollapse

if 'margin' then display the depth select buttons vertically along the side of the page choosen by buttonSide. If 'top' then display the depth select buttons horizontally under the button that hides the TOC. Defaults to 'margin'. 'bottom' is currently unimplemented.

hidden

Logical should the table of contents be hidden at page load Defaults to FALSE

Details

hidingTOC creates a table of contents in a Rmd document that can be hidden at the press of a button. It also generate buttons that allow the hiding or unhiding of the diffrent level depths of the table of contents.

Value

a HTML formated text string to be inserted into an markdown document

Author(s)

Thomas Dupont

Examples

## Not run: 
hidingTOC()

## End(Not run)

Hmisc

Harrell Miscellaneous

v4.5-0
GPL (>= 2)
Authors
Frank E Harrell Jr <fh@fharrell.com>, with contributions from Charles Dupont and many others.
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.