Borrow/link a chapter from another bookdown course

Usage,
borrow_chapter(
  doc_path,
  repo_name = NULL,
  branch = "main",
  git_pat = NULL,
  base_url = "https://raw.githubusercontent.com",
  dest_dir = file.path("resources", "other_chapters")
)

Arguments

doc_path

A file path of markdown or R Markdown document of the chapter in the repository you are retrieving it from that you would like to include in the current document. e.g "docs/intro.md" or "intro.md"

repo_name

A character vector indicating the repo name of where you are borrowing from. e.g. "jhudsl/OTTR_Template/". For a Wiki of a repo, use "wiki/jhudsl/OTTR_Template/" If nothing is provided, will look for local file.

branch

Default is to pull from main branch, but need to declare if other branch is needed.

git_pat

A personal access token from GitHub. Only necessary if the repository being checked is a private repository.

base_url

it's assumed this is coming from github so it is by default 'https://raw.githubusercontent.com/'

dest_dir

A file path where the file should be stored upon arrival to the current repository.

Value

An Rmarkdown or markdown is knitted into the document from another repository

Examples

if (FALSE) {

# In an Rmarkdown document:

# For a file in another repository:
# ```{r, echo=FALSE, results='asis'}
borrow_chapter(
  doc_path = "docs/02-chapter_of_course.md",
  repo_name = "jhudsl/OTTR_Template"
)
# ```

# For a local file:
# ```{r, echo=FALSE, results='asis'}
borrow_chapter(doc_path = "02-chapter_of_course.Rmd")
# ```
}