cli_bullets_raw seems to try to glue substitute <var>, is that the expected behaviour?
It seems that `cli_bullets_raw` tries to glue substitute `<x>` for the value of x, which fails because parent.frame() is not passed to `glue_cmd` in `cli_bullets_raw`. I don't understand if this is expected behaviour (the attempt to substitute) or something that is missing in `cli_escape` to `gsub("<", "<<", ...)` and `gsub(">", ">>", ...)`. Below is a reprex.
``` r
library(cli)
x <- 5
# as expectd: styles and performs glue substitutions for {var} but not for <var>
"{.field field} {x}" |> cli_bullets()
#> field 5
"{.field field} <x>" |> cli_bullets()
#> field <x>
# as expectd: does NOT style or perform glue substitutions
"{.field field} {x}" |> cli_bullets_raw()
#> {{.field field}} {{x}}
# unexpected: seems to try to glue substitute x (but parent.frame() not passed to glue_cmd so it fails)
"{.field field} <x>" |> cli_bullets_raw()
#> Error in eval(expr, envir = envir): object 'x' not found
# solves the problem: replaces < wit << and > with >>
"{.field field} <<x>>" |> cli_bullets_raw()
#> {{.field field}} <x>
```
<sup>Created on 2025-08-27 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>
0 条评论