as_comment_str | R Documentation |
Takes a vector of paragraphs, wraps them at the specified line width, prefixes them with comment markers and returns the result as a single string.
as_comment_str(
...,
line_width = 160L,
comment_prefix = "# ",
sep_paragraphs = TRUE
)
... |
Comment lines. A character vector or something coercible to. |
line_width |
Maximum character width at which to wrap lines. A positive integerish scalar. |
comment_prefix |
Character sequence that indicates the start of a comment. A character scalar. |
sep_paragraphs |
Whether or not to separate paragraphs with an empty comment line. |
A character scalar.
Other string functions:
as_chr()
,
as_line_feed_chr()
,
as_str()
,
capitalize_first()
,
dsv_colnames()
,
enum_str()
,
escape_lf()
,
fuse_regex()
,
prettify_nr()
,
sentenceify()
,
wrap_chr()
pal::as_comment_str(glue::glue("Copyright (C) {format(Sys.Date(), '%Y')} Santa Clause"),
"No presents without code.") |>
cat()
# wrap lines at 20 chars
pal::as_comment_str(glue::glue("Copyright (C) {format(Sys.Date(), '%Y')} Santa Clause"),
"No presents without code.",
line_width = 20L) |>
cat()
# disable empty comment lines between paragraphs:
pal::as_comment_str(glue::glue("Copyright (C) {format(Sys.Date(), '%Y')} Santa Clause"),
"Hohoho.",
sep_paragraphs = FALSE) |>
cat()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.