md_image: Markdown image links

View source: R/md-link.R

md_imageR Documentation

Markdown image links

Description

Take character vectors of alternative text, image link destinations, and optional titles and return single glue vector of valid markdown inline image links. This inline is rendered as the ⁠<img>⁠ HTML tag. Note that the expected arguments of md_image() are reversed from md_link()

Usage

md_image(url, alt = "", title = NULL, ..., .name = FALSE)

Arguments

url

A character vector of link destination (URL) strings.

alt

A character vector of alternative text that can be used to refer to an image.

title

The optional title of the link.

...

A sequence of alt = "/url" named vector pairs. If any such pairs are provided, .name will be considered TRUE.

.name

logical; if TRUE, the pairs in ... will be used instead of any values supplied to x and url.

Details

Syntax for images is like the syntax for links, with one difference. Instead of link text, we have an image description. The rules for this are the same as for link text, except that (a) an image description starts with ⁠![⁠ rather than [, and (b) an image description may contain links. An image description has inline elements as its contents. When an image is rendered to HTML, this is standardly used as the image’s alt attribute.

Value

A glue vector of collapsed display text and associated URLs.

A glue vector of collapsed alternative text and associated URLs.

See Also

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

Examples

if (file.exists("man/figures/logo.png")) md_image("man/figures/logo.png")
md_image("http://hexb.in/hexagons/eff.png")
md_image(EFF = "http://hexb.in/hexagons/eff.png")
md_image("http://hexb.in/hexagons/eff.png", "EFF Hex Sticker", "Logo")

gluedown documentation built on May 29, 2024, 11:42 a.m.