a_: Create an anchor element

Description Usage Arguments

Description

Allows for the creation of an anchor element. This is for creating a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.

Usage

1
2
3
a_(..., id = NULL, class = NULL, global = NULL, href = NULL,
  target = NULL, download = NULL, media = NULL, type = NULL,
  rel = NULL, hreflang = NULL)

Arguments

...

a collection of HTML objects, textual elements (as bare text or Markdown-styled text), arbitrary attributes (given as named variables).

id

a global attribute for specifying a unique ID for an HTML element (the value must be unique within the HTML document, though, this is not currently enforced here). The primary use of the id attribute is to point to a style in a style sheet. The id is also used by JavaScript (via the HTML DOM) to manipulate the element with the specific id.

When constructing an id, there are a few other things to note: (1) it must contain at least one character, (2) it must not contain any space characters, and (3) in HTML, all values are case-insensitive.

class

a global attribute for specifying one or more classnames for an element. The class attribute is primarily used in pointing to a class in a style sheet. However, this attribute can also be used by a JavaScript (via the HTML DOM) to make changes to HTML elements with a specified class. If providing several classes, one can either use c("[classname1]", "[classname2]", ...) or a single string with space-separated class names.

When constructing class names, there are two things to keep in mind: (1) they begin with a letter (A-Z or a-z), and (2) subsequent characters can be letters (A-Za-z), digits (0-9), hyphens, and underscores.

global

provides an opportunity to supply global attributes other than the id and class attributes (which have their own arguments). This is most easily accomplished via the namesake global() function since it allows for inline help and validation for each of the global attributes. For example, setting the global attributes title and lang can be done by using this: global = global(lang = "en", title = "my_title").

href

the URL of the page to which the link is directed.

target

specifies where to open the linked document. There are 4 options here: (1) _self (the default) opens the linked document in the same frame as it was clicked, (2) _blank opens the linked document in a new window or tab, (3) _parent opens the linked document in the parent frame, and (4) _top opens the linked document in the full body of the window.

download

specifies that the target will be downloaded when a user clicks on the hyperlink. This attribute is only used if the href attribute is set. The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.). If the value is omitted, the original filename is used.

media

this specifies what media/device the linked document is optimized for. This attribute is used to specify that the target URL is designed for special devices, speech, or print media. This attribute can accept several values.

type

specifies the Internet media type (formerly known as MIME type) of the linked document. This attribute is only used if the href attribute is set.

rel

this attribute specifies the relationship between the current document and the linked document. It is only used if the href attribute is present.

hreflang

specifies the language of the linked document. This attribute is only used if the href attribute is set.


rich-iannone/hyper documentation built on May 28, 2019, 4:02 p.m.