md_code: Markdown code span

View source: R/md-inlines.R

md_codeR Documentation

Markdown code span

Description

Take a character vector and wrap each element in backticks to create a glue vector of inline code spans. This inline is rendered as a ⁠<code>⁠ HTML tag.

Usage

md_code(x)

Arguments

x

The text to be formatted as fixed-width inline code.

Details

A backtick string is a string of one or more backtick characters that is neither preceded nor followed by a backtick.

A code span begins with a backtick string and ends with a backtick string of equal length. The contents of the code span are the characters between the two backtick strings, normalized in the following ways: * First, line endings are converted to spaces. * If the resulting string both begins and ends with a space character, but does not consist entirely of space characters, a single space character is removed from the front and back. This allows you to include code that begins or ends with backtick characters, which must be separated by whitespace from the opening or closing backtick strings.

Value

A glue vector of length equal to x.

See Also

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

Examples

md_code("ex_var")
md_code(state.name[1:3])

gluedown documentation built on Nov. 2, 2023, 5:48 p.m.