Title: Hyperlink Automatic Detection
Version: 2024.4.0
Description: Automatic detection of hyperlinks for packages and calls in the text of 'rmarkdown' or 'quarto' documents.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.1
Imports: bslib, downlit, glue, htmltools, httr2, knitr, rlang, stringr, xml2
URL: https://link.tada.science/, https://github.com/tadascience/link
BugReports: https://github.com/tadascience/link/issues
NeedsCompilation: no
Packaged: 2024-03-09 18:09:36 UTC; romainfrancois
Author: Romain François [aut, cre], tada.science [cph, fnd]
Maintainer: Romain François <romain@tada.science>
Repository: CRAN
Date/Publication: 2024-03-11 18:50:05 UTC

Setup automatic linking

Description

Setup automatic linking

Usage

auto(type = c("tooltip", "plain"), keep_braces = TRUE, keep_pkg_prefix = TRUE)

to_pkg(pkg, type = c("tooltip", "plain"), keep_braces = TRUE, ...)

to_call(call, type = c("tooltip", "plain"), keep_pkg_prefix = TRUE, ...)

Arguments

type

"plain" for plain links, "tooltip" for adding a tooltip

keep_braces

Should the braces be kept ?

keep_pkg_prefix

Should the package prefix be kept ?

pkg

package name

...

See bslib::tooltip()

call

Function call of the form pkg::fun()

Value

to_pkg() and to_call() return text to include in html documents

Examples


## Not run: 
  # auto is mostly meant to be called inside rmarkdown or quarto documents
  auto()
  auto(keep_braces = FALSE, keep_pkg_prefix = FALSE)

  # manually generate the tooltips for {pkg} and pkg::fun()
  link::to_pkg("tidyverse")
  link::to_pkg("tidyverse")

  link::to_call("dplyr::summarise()")
  link::to_call("dplyr::summarise()")

## End(Not run)

link::to_pkg("tidyverse", type = "plain")
link::to_call("dplyr::summarise()", type = "plain")