Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glue-like string interpolation? #6

Closed
thomasp85 opened this issue Apr 24, 2024 · 2 comments
Closed

glue-like string interpolation? #6

thomasp85 opened this issue Apr 24, 2024 · 2 comments

Comments

@thomasp85
Copy link
Member

No description provided.

@olivroy
Copy link

olivroy commented May 1, 2024

Supporting cli inline markup would be awesome!

https://cli.r-lib.org/reference/inline-markup.html

Is there already a way to do this with ggplot2.

str <- cli::format_inline('{cli::col_red("Important things")} is {.val 1}')
cat(str, sep = "\n")

image

It would be great if this kind of syntax could be used in some way to add as ggplot2 title

library(ggplot2)
ggplot(mtcars) +
  labs(title = str)

It would be great if there was a way for ggplot2 to recognize a syntax that allows coloring / styling.

The already existing cli syntax for markup could be used / recognized?

cli has ansi_html(), which may help?

cli::ansi_html(str)

@thomasp85
Copy link
Member Author

Understanding cli styling is out of scope, but you can color text using custom spans such as {.red this will be red} (which is very akin to cli syntax). In the same way you can make custom styles

@thomasp85 thomasp85 reopened this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants