style_hyperlink: Terminal Hyperlinks

View source: R/ansi-hyperlink.R

style_hyperlinkR Documentation

Description

ansi_hyperlink() creates an ANSI hyperlink.

Usage

style_hyperlink(text, url, params = NULL)

ansi_has_hyperlink_support()

ansi_hyperlink_types()

Arguments

text

Text to show. text and url are recycled to match their length, via a paste0() call.

url

URL to link to.

params

A named character vector of additional parameters, or NULL.

Details

This function is currently experimental. In particular, many of the ⁠ansi_*()⁠ functions do not support it properly.

ansi_has_hyperlink_support() checks if the current stdout() supports hyperlinks.

See also https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda.

ansi_hyperlink_types() checks if current stdout() supports various types of hyperlinks. It returns a list with entries href, run, help and vignettes.

Value

Styled cli_ansi_string for style_hyperlink(). Logical scalar for ansi_has_hyperlink_support().

Examples

cat("This is an", style_hyperlink("R", "https://r-project.org"), "link.\n")
ansi_has_hyperlink_support()

cli documentation built on June 22, 2024, 10:57 a.m.