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

Bad interaction with fs_path default formatting and hyperlink generation #683

Open
DavisVaughan opened this issue Apr 10, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Apr 10, 2024

See also r-lib/pkgdown#2436

In pkgdown we accidentally tried to interpolate fs paths into cli strings and that caused some bad link generation. I think it has something to do with the fs_path default theming? Notice how the blue output below isn't right.

Screenshot 2024-04-10 at 9 37 48 AM
library(cli)
library(fs)

testthat::local_reproducible_output(hyperlinks = TRUE)

path <- "~/Desktop/foo.R"
cli::cli_inform("{.run ['hi mom']({path})}")
#> �]8;;x-r-run:~/Desktop/foo.R�'hi mom'�]8;;�

path <- fs::path("~/Desktop/foo.R")
cli::cli_inform("{.run ['hi mom']({path})}")
#> �]8;;x-r-run:'�]8;;file:///Users/davis/Desktop/foo.R�~/Desktop/foo.R�]8;;�'�'hi mom'

# real example was more like this
# clicking the link should run `pkgdown::preview_page('~/Desktop/foo.R')`
path <- "~/Desktop/foo.R"
cli::cli_inform("{.run ['file.R'](pkgdown::preview_page('{path}'))}")
#> �]8;;x-r-run:pkgdown::preview_page('~/Desktop/foo.R')�'file.R'�]8;;�

# weirdness
path <- fs::path("~/Desktop/foo.R")
cli::cli_inform("{.run ['file.R'](pkgdown::preview_page('{path}'))}")
#> �]8;;x-r-run:pkgdown::preview_page(''�]8;;file:///Users/davis/Desktop/foo.R�~/Desktop/foo.R�]8;;�'')�'file.R'

Created on 2024-04-10 with reprex v2.0.2

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Jun 20, 2024
@gaborcsardi gaborcsardi added the tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

No branches or pull requests

2 participants