Skip to content

cli_bullets_raw seems to try to glue substitute <var>, is that the expected behaviour? #789

Description

@sebkopf

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.

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>

Created on 2025-08-27 with reprex v2.1.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions