Package 'rambutan'

Title: Fast Link Checking Powered by 'lychee'
Description: An interface to the 'lychee' Rust crate (<https://github.com/lycheeverse/lychee>), a fast, async link checker. Wraps 'lychee-lib' via 'extendr' to check URLs, files, and directories for broken links.
Authors: Athanasia Mo Mowinckel [aut, cre] (ORCID: <https://orcid.org/0000-0002-5756-0223>, GitHub: drmowinckels)
Maintainer: Athanasia Mo Mowinckel <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2026-10-05 07:55:13 UTC
Source: https://github.com/drmowinckels/rambutan

Help Index


Check links found in a single file

Description

Convenience wrapper around check_paths() for the common case of scanning one file, with a clearer error when file doesn't exist or is a directory.

Usage

check_file(file, options = lychee_options())

Arguments

file

Path to a single existing file to scan for links.

options

A lychee_options object created by lychee_options().

Value

A data frame with one row per discovered link: source, line, column, url, is_success, code, details.

Examples

## Not run: 
check_file("README.md")

## End(Not run)

Check links found in every file within a folder

Description

Convenience wrapper around check_paths() for scanning a directory. By default the whole directory tree is scanned, exactly like check_paths(path). Set recursive = FALSE to scan only the files directly inside path, or extensions to restrict the scan to files with the given extensions; both are implemented as glob patterns handed to check_paths(), so hidden files/directories and anything matched by a .gitignore are skipped in every case, same as the 'lychee' CLI.

Usage

check_folder(
  path,
  recursive = TRUE,
  extensions = NULL,
  options = lychee_options()
)

Arguments

path

Path to a single existing directory to scan for links.

recursive

Single logical. Scan subdirectories as well? Defaults to TRUE.

extensions

Character vector of file extensions (with or without the leading dot, e.g. c("md", "html")) to restrict the scan to, or NULL to scan every file lychee can extract links from.

options

A lychee_options object created by lychee_options().

Value

A data frame with one row per discovered link: source, line, column, url, is_success, code, details.

Examples

## Not run: 
check_folder("vignettes")
check_folder("vignettes", recursive = FALSE)
check_folder(".", extensions = "md")

## End(Not run)

Check every URL referenced in an R package's sources

Description

Scans the same files CRAN's automated URL checks (and ⁠R CMD check --as-cran⁠) inspect – DESCRIPTION, Rd files in ⁠man/⁠, CITATION, NEWS.Rd/NEWS.md, README.md, and built HTML vignettes – plus unbuilt R Markdown vignette sources, then checks every URL found with check_url().

Usage

check_package(path = ".", options = lychee_options())

Arguments

path

Path to the root of an R package's source tree. Defaults to the current directory.

options

A lychee_options object created by lychee_options().

Value

A data frame with one row per checked URL: url, parent (the file the URL was found in), is_success, code, and details.

Examples

## Not run: 
check_package(".")

## End(Not run)

Check links found in files, directories, or glob patterns

Description

Scans the given paths for links using 'lychee's built-in Markdown, HTML, and plain-text extractors, then checks every link found.

Usage

check_paths(paths, options = lychee_options())

Arguments

paths

Character vector of file paths, directories, or glob patterns (e.g. "**/*.md") to scan for links.

options

A lychee_options object created by lychee_options().

Value

A data frame with one row per discovered link: source, line, column, url, is_success, code, details.

Examples

## Not run: 
check_paths("README.md")
check_paths(c("README.md", "vignettes"))

## End(Not run)

Check links found across an entire project directory

Description

Convenience wrapper around check_paths() for scanning a whole project tree, recursively, while skipping directories that are virtually never meant to be link-checked – installed dependencies and build artifacts. Hidden files and directories (e.g. .git, .Rproj.user) are always skipped. Unlike check_package(), check_project() makes no assumption that path is an R package.

Usage

check_project(
  path = ".",
  exclude_dirs = c("node_modules", "renv", "packrat", "target", "dist", "build",
    "vendor"),
  options = lychee_options()
)

Arguments

path

Path to the root of the project to scan. Defaults to the current directory.

exclude_dirs

Character vector of directory names to skip anywhere in the tree, in addition to hidden directories, which are always skipped. Defaults to common dependency and build-artifact directories (node_modules, renv, packrat, target, dist, build, vendor).

options

A lychee_options object created by lychee_options().

Value

A data frame with one row per discovered link: source, line, column, url, is_success, code, details.

Examples

## Not run: 
check_project(".")

## End(Not run)

Check a single URL

Description

Check a single URL

Usage

check_url(url, options = lychee_options())

Arguments

url

A single URL string to check.

options

A lychee_options object created by lychee_options().

Value

A list with url, is_success, code, and details.

Examples

## Not run: 
check_url("https://www.r-project.org")

## End(Not run)

Check multiple URLs concurrently

Description

Vectorised version of check_url(). URLs are checked concurrently rather than one at a time.

Usage

check_urls(urls, options = lychee_options())

Arguments

urls

Character vector of URLs to check.

options

A lychee_options object created by lychee_options().

Value

A data frame with one row per element of urls (in the same order): url, is_success, code, details.

Examples

## Not run: 
check_urls(c("https://www.r-project.org", "https://cran.r-project.org"))

## End(Not run)

Configure optional lychee behaviour

Description

Builds the options object accepted by check_url(), check_urls(), check_paths(), and check_package(). Every argument here shares its name with the matching field in a lychee.toml file – the same configuration file read by the 'lychee' CLI. When a lychee.toml is present in the current working directory it is picked up automatically; values passed here take precedence over the file, the file takes precedence over 'lychee-lib's own defaults, and exclude/include/ header are combined with the file rather than replacing it.

Usage

lychee_options(
  exclude = character(),
  include = character(),
  timeout = NULL,
  max_redirects = NULL,
  max_retries = NULL,
  retry_wait_time = NULL,
  user_agent = NULL,
  method = NULL,
  accept = character(),
  exclude_all_private = NULL,
  exclude_private = NULL,
  exclude_link_local = NULL,
  exclude_loopback = NULL,
  require_https = NULL,
  include_mail = NULL,
  header = NULL
)

Arguments

exclude

Character vector of regular expressions. URLs matching any pattern are treated as excluded rather than checked.

include

Character vector of regular expressions. URLs matching any pattern are always checked, even if they also match exclude.

timeout

Request timeout in seconds, or NULL to use the default (20).

max_redirects

Maximum number of redirects to follow, or NULL to use the default (10).

max_retries

Maximum number of retries per request, or NULL to use the default (3).

retry_wait_time

Initial wait time in seconds between retries, or NULL to use the default (1).

user_agent

User agent string sent with every request, or NULL to use lychee's default.

method

A single HTTP method, e.g. "get" or "head", or NULL to use the default ("get").

accept

Character vector of accepted status codes/ranges, e.g. c("200..=204", "429"). Defaults to lychee's own accepted range when empty.

exclude_all_private

Single logical. Exclude all private, link-local, and loopback IP addresses, or NULL.

exclude_private

Single logical. Exclude private IP addresses, or NULL.

exclude_link_local

Single logical. Exclude link-local IP addresses, or NULL.

exclude_loopback

Single logical. Exclude loopback IP addresses, or NULL.

require_https

Single logical. Treat unencrypted HTTP links as errors when HTTPS is available, or NULL.

include_mail

Single logical. Also check ⁠mailto:⁠ links, or NULL.

header

Named character vector of custom HTTP headers sent with every request, or NULL.

Value

A list with class lychee_options.

Examples

lychee_options(timeout = 10, exclude = "^https://example\\.com")