wflow_toc: Create table of contents

View source: R/wflow_toc.R

wflow_tocR Documentation

Create table of contents

Description

wflow_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.

Usage

wflow_toc(
  ignore_nav_bar = TRUE,
  clipboard = TRUE,
  only_published = 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.

only_published

logical (default: TRUE) Include only published contents.

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.

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 clipboard = FALSE to send the table of contents to the R console to manually copy-paste.

Value

Invisibly returns the table of contents as a character vector.


workflowr documentation built on Aug. 23, 2023, 1:09 a.m.