Hyperlink Automatic Detection • link link is a simple goofy R 📦 that makes it simple to include links to packages, e.g. Easily Install and Load the Tidyverse • tidyverse tidyverse , A Grammar of Data Manipulation • dplyr dplyr and function calls Summarise each group down to one row — summarise • dplyr summarise() Create a new ggplot — ggplot • ggplot2 ggplot() in your .Rmd
or .qmd
files.
This works by setting the knitr - Elegant, flexible, and fast dynamic report generation with R - Yihui Xie | 谢益辉 knitr text
hook with Setup automatic linking — to_pkg • link auto() somewhere in your document. You can learn more about knitr - Elegant, flexible, and fast dynamic report generation with R - Yihui Xie | 谢益辉 knitr hooks in the Writing knitr hooks article from Danielle Navarro’s Notes from a data witch blog.
```{r}
#| 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.
Hyperlink Automatic Detection • link link is heavily based on Syntax Highlighting and Automatic Linking • downlit downlit and especially Generate url for topic/article/package — href_topic • downlit href_package() and Automatically link inline code — autolink • downlit autolink() which do the actual work. We just go the extra mile and make this automatic by means of a knitr - Elegant, flexible, and fast dynamic report generation with R - Yihui Xie | 谢益辉 knitr hook.
This very article uses Setup automatic linking — to_pkg • link auto() , i.e. here is how it looks in rstudio: