wfow_toc creates a table of contents of the published R Markdown files. The output is in markdown format, so you can paste it into a document such as index.Rmd. If the R package clipr is installed, the table of contents is copied to the clipboard. Otherwise the output is sent to the R console.

wflow_toc(ignore_nav_bar = TRUE, clipboard = TRUE, project = ".")

Arguments

ignore_nav_bar

logical (default: TRUE). Ignore any HTML files included as links in the navigation bar.

clipboard

logical (default: TRUE) Attempt to copy table of contents to clipboard. Only relevant if clipr package is installed and the system keyboard is available.

project

character (default: ".") By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory.

Value

Invisibly returns the table of contents as a character vector.

Details

The default behavior is to attempt to copy the table of contents to the clipboard for easy pasting into an R Markdown document. If this isn't working for you, you can try the following:

  • Check that the clipr package is installed: install.packages("clipr")

  • Check that the system keyboard is writable. Run clipr_available and dr_clipr.

  • If it's still not working, set keyboard = FALSE to send the table of contents to the R console to manually copy-paste.