git_down {gitdown}R Documentation

Turns the active branch history of git into a bookdown.

Description

Read all commit messages of your local git repository and sort them according to tags or specific text pattern into chapters of a HTML book using 'bookdown'. Each chapter is a group of commits. The first page gives a summary of all the groups.

Usage

git_down(
  repo = ".",
  book_path = "gitdown",
  open = TRUE,
  author = "John Doe",
  pattern = c(Issues = "#[[:digit:]]+"),
  pattern.table = NULL,
  ref = "main",
  ...
)

Arguments

repo

The path to a repository. Default is .

book_path

The path to the bookdown output. Default is "gitdown".

open

Should the bookdown be opened once compiled? Default is TRUE.

author

Author of the bookdown

pattern

Named vector with regex pattern to expose commits, like ⁠c("Issues" = "#\[\[:digit:\]\]")⁠ for issues

pattern.table

data.frame with two columns: pattern and description of the pattern. This is used as correspondence table to add some names to existing patterns.

ref

the name of the branch, by default main

...

Other parameters to pass to rmarkdown::render()

Value

Path of the HTML gitbook saved in the repo/book_path directory.

Examples

repo <- fake_repo()
if (rmarkdown::pandoc_available("2.0.0")) {
  res <- git_down(repo, pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
    open = FALSE)
}
## Not run: 
# Open the book
  browseURL(res)

## End(Not run)
# With table of correspondence
pattern.table <- data.frame(number = c("#2", "#1"),
  title = c("#2 A second issue to illustrate a blog post",
                       "#1 An example of issue"))
if (rmarkdown::pandoc_available("2.0.0")) {
  res <- git_down(repo, pattern = c("Issues" = "#[[:digit:]]+"),
    pattern.table = pattern.table, open = FALSE)
}
## Not run: 
# Open the book
  browseURL(res)

## End(Not run)

[Package gitdown version 0.1.6 Index]