marquee_glue | R Documentation |
If you want to create your markdown programmatically you'd probably want to
use some sort of string interpolation such as glue()
. However, the custom
span syntax of marquee interferes with the standard interpolation syntax of
glue. This function let's you use both together.
marquee_glue(
...,
.sep = "",
.envir = parent.frame(),
.open = "{",
.close = "}",
.na = "NA",
.null = character(),
.comment = character(),
.literal = FALSE,
.transformer = NULL,
.trim = TRUE
)
marquee_glue_data(
.x,
...,
.sep = "",
.envir = parent.frame(),
.open = "{",
.close = "}",
.na = "NA",
.null = character(),
.comment = character(),
.literal = FALSE,
.transformer = NULL,
.trim = TRUE
)
... |
[ For `glue_data()`, elements in `...` override the values in `.x`. |
.sep |
[ |
.envir |
[ |
.open |
[ |
.close |
[ |
.na |
[ |
.null |
[ |
.comment |
[ |
.literal |
[ |
.transformer |
[ |
.trim |
[ |
.x |
[ |
If you choose a different set of delimiters than "{"
and "}"
for the
interpolation the functions will call the equivalent glue functions directly.
However, if you keep the defaults, the functions will use a custom
transformer that will make sure to keep the marquee custom span notation. You
can both interpolate the content of the span, as well as the span class (see
examples)
A character vector
# standard use
red_text <- "this text will be red"
marquee_glue("This will be black and {.red {red_text}}!")
# if the span is not valid it will be treated as standard glue interpolation
try(
marquee_glue("This will be black and {.red}!")
)
# You can interpolate the tag name as well
col <- "green"
marquee_glue("This will be black and {.{col} this text will be {col}}!")
# Tag name interpolation must follow a `.` or a `#` as these identify the
# bracket pair as a custom span class
col <- ".yellow"
# This is not what you want probably
marquee_glue("This will be black and {{col} this text will be {col}}!")
# Tag interpolation should also interpolate the full tag and be followed by
# a space in order to be valid
part <- "l"
marquee_glue("This will be black and {.ye{part}low this text will be {col}}!")
try(
marquee_glue("This will be black and {.{part}avender this text will be {col}}!")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.