🔗 link

link is a simple R 📦 that makes it easier to include links to packages pkgdown pages

Romain François


February 26, 2024

link is a simple goofy R 📦 that makes it simple to include links to packages, e.g.  tidyverse , dplyr and function calls summarise() ggplot() in your .Rmd or .qmd files.

This works by setting the knitr text hook with auto() somewhere in your document. You can learn more about knitr hooks in the Writing knitr hooks article from Danielle Navarro’s Notes from a data witch blog.

#| echo: false
link::auto(keep_braces = FALSE, keep_pkg_prefix = FALSE)

The defaults keep_braces = TRUE and keep_pkg_prefix keeps the braces around the 📦 names and the package prefix in the calls. This is popular style but I don’t like it and find it too noisy.

link is heavily based on downlit and especially href_package() and autolink() which do the actual work. We just go the extra mile and make this automatic by means of a knitr hook.

This very article uses auto() , i.e. here is how it looks in rstudio: