Learn R Programming

gluedown (version 1.0.2)

md_link: Markdown inline link (6.6)

Description

Take character vectors of link texts, link destinations, and optional titles and return single glue vector of valid markdown inline links. This inline is rendered as the <href> HTML tag.

Usage

md_link(x, url = NULL, title = NULL)

Arguments

x

either: (1) A named vector, with names set to the hyperlink text and elements set to the accompanying URL; or (2) a simple character vector of text with another vector of URLs passed to the url argument.

url

The URL to lead to.

title

The optional title of the link.

Value

A glue vector of collapsed display text and associated URLs.

Details

A link contains link text (the visible text), a link destination (the URI that is the link destination), and optionally a link title. There are two basic kinds of links in Markdown. In inline links the destination and title are given immediately after the link text.

A link text consists of a sequence of zero or more inline elements enclosed by square brackets ([ and ])...

An inline link consists of a link text followed immediately by a left parenthesis (, optional whitespace, an optional link destination, an optional link title separated from the link destination by whitespace, optional whitespace, and a right parenthesis ). The link<U+2019>s text consists of the inlines contained in the link text (excluding the enclosing square brackets). The link<U+2019>s URI consists of the link destination, excluding enclosing <...> if present, with backslash-escapes in effect as described above. The link<U+2019>s title consists of the link title, excluding its enclosing delimiters, with backslash-escapes in effect as described above.

See Also

Other inline functions: md_autolink(), md_bold(), md_code(), md_convert(), md_disallow(), md_escape(), md_hardline(), md_image(), md_issue(), md_italic(), md_softline(), md_strike(), md_text()

Examples

Run this code
# NOT RUN {
md_link("tidyverse", "https://www.tidyverse.org/")
md_link(c(CRAN = "https://cran.r-project.org/"))
# }

Run the code above in your browser using DataLab