Automatically link inline code

autolink(text)

autolink_url(text)

Arguments

text

String of code to highlight and link.

Value

If text is linkable, an HTML link for autolink(), and or just the URL for autolink_url(). Both return NA if the text is not linkable.

Examples

autolink("stats::median()")
#> [1] "<a href='https://rdrr.io/r/stats/median.html'>stats::median()</a>"
autolink("vignette('grid', package = 'grid')")
#> [1] "<a href='https://cran.rstudio.com/web/packages/grid/vignettes/grid.pdf'>vignette('grid', package = 'grid')</a>"
autolink_url("stats::median()")
#> [1] "https://rdrr.io/r/stats/median.html"