| 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 |
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.
check_file(file, options = lychee_options())check_file(file, options = lychee_options())
file |
Path to a single existing file to scan for links. |
options |
A |
A data frame with one row per discovered link: source, line,
column, url, is_success, code, details.
## Not run: check_file("README.md") ## End(Not run)## Not run: check_file("README.md") ## End(Not run)
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.
check_folder( path, recursive = TRUE, extensions = NULL, options = lychee_options() )check_folder( path, recursive = TRUE, extensions = NULL, options = lychee_options() )
path |
Path to a single existing directory to scan for links. |
recursive |
Single logical. Scan subdirectories as well? Defaults
to |
extensions |
Character vector of file extensions (with or without
the leading dot, e.g. |
options |
A |
A data frame with one row per discovered link: source, line,
column, url, is_success, code, details.
## Not run: check_folder("vignettes") check_folder("vignettes", recursive = FALSE) check_folder(".", extensions = "md") ## End(Not run)## Not run: check_folder("vignettes") check_folder("vignettes", recursive = FALSE) check_folder(".", extensions = "md") ## End(Not run)
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().
check_package(path = ".", options = lychee_options())check_package(path = ".", options = lychee_options())
path |
Path to the root of an R package's source tree. Defaults to the current directory. |
options |
A |
A data frame with one row per checked URL: url, parent (the
file the URL was found in), is_success, code, and details.
## Not run: check_package(".") ## End(Not run)## Not run: check_package(".") ## End(Not run)
Scans the given paths for links using 'lychee's built-in Markdown, HTML, and plain-text extractors, then checks every link found.
check_paths(paths, options = lychee_options())check_paths(paths, options = lychee_options())
paths |
Character vector of file paths, directories, or glob
patterns (e.g. |
options |
A |
A data frame with one row per discovered link: source, line,
column, url, is_success, code, details.
## Not run: check_paths("README.md") check_paths(c("README.md", "vignettes")) ## End(Not run)## Not run: check_paths("README.md") check_paths(c("README.md", "vignettes")) ## End(Not run)
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.
check_project( path = ".", exclude_dirs = c("node_modules", "renv", "packrat", "target", "dist", "build", "vendor"), options = lychee_options() )check_project( path = ".", exclude_dirs = c("node_modules", "renv", "packrat", "target", "dist", "build", "vendor"), options = lychee_options() )
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 ( |
options |
A |
A data frame with one row per discovered link: source, line,
column, url, is_success, code, details.
## Not run: check_project(".") ## End(Not run)## Not run: check_project(".") ## End(Not run)
Check a single URL
check_url(url, options = lychee_options())check_url(url, options = lychee_options())
url |
A single URL string to check. |
options |
A |
A list with url, is_success, code, and details.
## Not run: check_url("https://www.r-project.org") ## End(Not run)## Not run: check_url("https://www.r-project.org") ## End(Not run)
Vectorised version of check_url(). URLs are checked concurrently rather
than one at a time.
check_urls(urls, options = lychee_options())check_urls(urls, options = lychee_options())
urls |
Character vector of URLs to check. |
options |
A |
A data frame with one row per element of urls (in the same
order): url, is_success, code, details.
## Not run: check_urls(c("https://www.r-project.org", "https://cran.r-project.org")) ## End(Not run)## Not run: check_urls(c("https://www.r-project.org", "https://cran.r-project.org")) ## End(Not run)
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.
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 )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 )
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 |
timeout |
Request timeout in seconds, or |
max_redirects |
Maximum number of redirects to follow, or |
max_retries |
Maximum number of retries per request, or |
retry_wait_time |
Initial wait time in seconds between retries, or
|
user_agent |
User agent string sent with every request, or |
method |
A single HTTP method, e.g. |
accept |
Character vector of accepted status codes/ranges, e.g.
|
exclude_all_private |
Single logical. Exclude all private,
link-local, and loopback IP addresses, or |
exclude_private |
Single logical. Exclude private IP addresses,
or |
exclude_link_local |
Single logical. Exclude link-local IP
addresses, or |
exclude_loopback |
Single logical. Exclude loopback IP addresses,
or |
require_https |
Single logical. Treat unencrypted HTTP links as
errors when HTTPS is available, or |
include_mail |
Single logical. Also check |
header |
Named character vector of custom HTTP headers sent with
every request, or |
A list with class lychee_options.
lychee_options(timeout = 10, exclude = "^https://example\\.com")lychee_options(timeout = 10, exclude = "^https://example\\.com")