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

Tension between wanting to use {.run } over style_hyperlink() but not wanting backticks in fallback mode #684

Open
DavisVaughan opened this issue Apr 10, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Apr 10, 2024

In r-lib/pkgdown@52d696d we went from style_hyperlink() to the more ergonomic {.run } syntax.

Notice how in this case the text we show the user is not code, it is just some text that happens to run code behind the scenes. In fallback mode when we don't have hyperlink support, with style_hyperlink() this just showed the text as is, which worked quite well. Now with {.run } it gets styled as {.code } in fallback mode, which in practice adds backticks around the text (as seen in the snapshots) which is pretty odd.

i.e. we went from

Writing articles/index.html

to

Writing `articles/index.html`

That was also an issue here r-lib/roxygen2#1604 where I wanted to switch to {.run }, but the thing we show the user is actually a path so naturally we wrap it in {.path } too, i.e. it would end up like a nested {.path {.run [foo.R](code)}} call. In fallback mode this gets super weird, we get single quotes from the .path plus backticks from the .run, so something like '`foo.R`'

Ideally in this scenario the fallback for {.run } would not have used {.code } and would just show the text as is. However, I get that we often do show the user visible code, and that's what they click on, so the code fallback makes sense in that case (like the rlang::last_trace() hyperlink in error messages). Maybe we need a slightly different .run variant or something?

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Jun 20, 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
Projects
None yet
Development

No branches or pull requests

2 participants