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

Open
#684 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
cli

Research direction

Review the existing style_hyperlink() and {.run } fallback behavior, using the snapshots that show the added backticks as the starting point. Compare plain-text messages, visible code links, and nested {.path } cases. Done means the project has a decided fallback behavior that avoids inappropriate formatting without breaking code-oriented links.

Written by the indexing model from the issue text.

Description

bug

In https://github.com/r-lib/pkgdown/commit/52d696dfec4ab529f24f3243a00709256f341707 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 https://github.com/r-lib/roxygen2/pull/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?

Dominant language
R
Stars
726
Forks
94
Avg merge
3h 35m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/cli

All issues in r-lib/cli

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.