You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Specific helper for RStudio code execution links #456
Paired with inline formatter like .run. I'm pretty sure this this should be different to .code since that often contains unrunnable snippets.
It may need to be like .href because while we want to match the code clicked and run, we made want to vary the details, e.g. we show snapshot_accpet("foo.R") but we run testthat::snapshot_accept("~/documents/testthat/tests/_snaps/foo.R").
For IDE agnosticity, I think this is now ide:run: and should be guarded by nzchar(Sys.getenv("R_CLI_HAS_HYPERLINK_RUN")) (see #499). But @romainfrancois should confirm this.
I considered having {.url url link text} instead of a new {.href} style, but URLs are now styled by adding <...> currently, and that does not look good if there is link text, so it is better to have a new{.href}` style.
They keep formatting. It is not possible to use a different link text with them. We could add link text support, but theming is applied to the result of these tags, and it would look weird for link text. (I.e. if there is link text you don't want to append () to the function name, etc.)
N
Goal
Input
Links to (link text is always the verbatim content, styled)
Activity
hadley commentedon Apr 27, 2022
Paired with inline formatter like
.run. I'm pretty sure this this should be different to.codesince that often contains unrunnable snippets.It may need to be like
.hrefbecause while we want to match the code clicked and run, we made want to vary the details, e.g. we showsnapshot_accpet("foo.R")but we runtestthat::snapshot_accept("~/documents/testthat/tests/_snaps/foo.R").gaborcsardi commentedon Apr 27, 2022
Yeah, unfortunately, we are creating a (sub)DSL for this, but there isn't really another way. I'll write some DSL ideas in this issue later...
hadley commentedon May 2, 2022
Another case where this will be important is for pkgdown — we'd want to render links to websites, but not to local files or to run code.
hadley commentedon Jul 15, 2022
See complete list in rstudio/rstudio#11273 (comment)
lionel- commentedon Aug 15, 2022
For IDE agnosticity, I think this is now
ide:run:and should be guarded bynzchar(Sys.getenv("R_CLI_HAS_HYPERLINK_RUN"))(see #499). But @romainfrancois should confirm this.gaborcsardi commentedon Aug 25, 2022
Final list of link types: rstudio/rstudio#11273 (comment)
gaborcsardi commentedon Aug 26, 2022
gaborcsardi commentedon Aug 27, 2022
I considered having
{.url url link text}instead of a new{.href}style, but URLs are now styled by adding<...>currently, and that does not look good if there is link text, so it is better to have a new{.href}` style.gaborcsardi commentedon Sep 1, 2022
Auto-linking existing styles
They keep formatting. It is not possible to use a different link text with them. We could add link text support, but theming is applied to the result of these tags, and it would look weird for link text. (I.e. if there is link text you don't want to append
()to the function name, etc.){.email [email protected]}mailto:[email protected]{.file path/file}file:///abs/path/dile{.file /abs/path:line:col}file:///abs/path:line:col,params = list(line = line, col = col){.fun pkg::fun}x-r-help:pkg::fun{.fun fun}{.url url}urlNew styles to create links
These all have link text support, via the
[text](link)markdown syntax.{.help pkg::fun}{.fun pkg::fun}x-r-help:pkg::fun{.fun ?pkg::fun}{.help [text](pkg::fun)}textx-r-help:pkg::funtext ({.fun ?pkg::fun}){.topic pkg::topic}pkg::topicx-r-help:pkg::topic{.code ?pkg::topic}{.topic [text](pkg::topic)}textx-r-help:pkg::topictext ({.code pkg::topic}){.href url}{.url url}url{.url url}{.href [text](url)}texturltext ({.url url}){.run expr}{.code expr}x-r-run:expr{.code expr}{.run [code](expr)}{.code code}x-r-run:expr{.code expr}{.vignette pkg::name}pkg::namex-r-vignette:pkg::name{.code vignette(pkg::name)}{.vignette [text](pkg::name)}textx-r-vignette:pkg::nametext ({.code vignette(pkg::name)})hadley commentedon Sep 1, 2022
Suggestions for non-link forms:
?in front of the proposed text?<>(I think maybe only "link url" is missing that?)vignette(name, pkg)?gaborcsardi commentedon Sep 1, 2022
Sounds good. URLs are already in
<>, that's part of the default theme.gaborcsardi commentedon Sep 1, 2022
I updated the table above.