-
Notifications
You must be signed in to change notification settings - Fork 70
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
Provide "quote" inline formatter #227
Comments
It's also interesting to think about whether this should just be standard behaviour for some of the built-in inline styles (e.g. |
Should definitely be the case for paths, since trailing spaces are a definite real problem. Probably less so for function names. |
It is already the standard behavior AFAICT: ❯ x <- " weird "; cli::cli_text("qwe {.path {x}} qwe")
qwe ' weird ' qwe |
Ah, so the quotes surrounding I tend to think we want the quotes unconditionally, at least in the I also have a specific scheme for inline style (color) and quoting that helps to make a very important distinction:
It is likely that I should create custom inline styles, give them good names, etc. Although specific, I think my requirements are relevant to the more general question about the quoting behaviour of the inline formatters. |
I don't think we would want to quote generic cli_div(theme = list(.sheet = list(before = '"', after = '"')))
sh <- "sheet"
cli_alert_success("this is a {.sheet {sh}} here") #> v this is a "sheet" here sh <- " weird sheet "
cli_alert_success("this is a {.sheet {sh}} here") #> v this is a " weird sheet " here |
I kind of like the background colour idea for paths — it seems like a nice general solution. |
@hadley would you set the background color for the whole path, or just for the leading/trailing spaces? |
Just the leading/trailing spaces (to make it obvious that's there's something weird going on with your path). |
I think usually the text indicates that it is a file or package, etc. But I don't mind always adding the quotes, that's fine as well. |
I'll re-open this to always add the quotes, and also to choose a better marker bg: set it to the same color as the foreground. |
Do you mean always-always or ... always add quotes when I'm advocating for the latter, I think. I think I like the lack of quotes, when we have access to colour. But I could deal with always having quotes (that's what usethis currently does for some inline styles and it's fine). |
Yeah, we can make it conditional on color support as well. |
"
.Would want to be able to choose the quote marks and the colour.
The text was updated successfully, but these errors were encountered: