| Type: | Package |
| Title: | Generate Comment Boxes with Custom Alignment |
| Version: | 2.0.0 |
| Description: | Provides a function to generate comment boxes framed with '#' characters, with configurable width and text alignment (left, center, or right). Useful for formatting scripts and improving code readability. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-03-31 08:54:49 UTC; gm666338 |
| Author: | Grégoire Muller [aut, cre] |
| Maintainer: | Grégoire Muller <muller.gregoire@protonmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-04-03 15:30:12 UTC |
Generate a Comment Box
Description
Generates a comment box framed with # characters, with configurable
width and text alignment. Long words that exceed the inner width are
automatically split across multiple lines.
Usage
generate_comment_box(comment, width = 80, align = "center", print_box = TRUE)
Arguments
comment |
A non-empty string containing the comment to be framed. |
width |
The total width of the comment box in characters. Must be
greater than 4. Default is |
align |
The alignment of the text inside the box. One of
|
print_box |
Logical. If |
Value
If print_box is TRUE, prints the comment box to the console
and returns it invisibly as a character string.
If print_box is FALSE, returns the comment box as a single
character string with newline characters (\n) separating each row.
Examples
# Left-aligned comment box (returned as string)
box <- generate_comment_box("This is a sample comment",
align = "left", print_box = FALSE)
cat(box)
# Centered comment box printed to the console
generate_comment_box("This is a centered comment", align = "center")
# Right-aligned comment box with custom width
generate_comment_box("This is a right-aligned comment",
align = "right", width = 60)