| style_vector | R Documentation |
Style a Vector with Text Formatting
style_vector(
x,
output = "html",
bold = FALSE,
italic = FALSE,
monospace = FALSE,
smallcap = FALSE,
underline = FALSE,
strikeout = FALSE,
color = NULL,
fontsize = NULL,
indent = NULL
)
x |
A vector to be styled. |
output |
Output format for styling. One of "html", "latex", "typst", "markdown", "ansi". Defaults to "html". |
bold |
Logical; if |
italic |
Logical; if |
monospace |
Logical; if |
smallcap |
Logical; if |
underline |
Logical; if |
strikeout |
Logical; if |
color |
Text color. Must be of length 1 or
|
fontsize |
Font size in em units. Must be of length 1 or |
indent |
Text indentation in em units. Must be of length 1 or |
This function applies styling to a vector. It allows customization of text style (bold, italic, monospace), text color, font size, and text decorations (underline, strikeout). The styling is applied element-wise to the vector. Vectors are coerced with as.character() before styling.
A character vector with applied styling.
# Basic styling
style_vector(c("Hello", "World"), bold = TRUE, color = "red")
# Different styles per element
style_vector(
c("Bold text", "Italic text", "Monospace"),
bold = c(TRUE, FALSE, FALSE),
italic = c(FALSE, TRUE, FALSE),
monospace = c(FALSE, FALSE, TRUE)
)
# Single style applied to all elements
style_vector(c("A", "B", "C"), color = "blue", fontsize = 1.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.