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

Add advice for text + line + col + file hyperlink #670

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion R/cliapp-docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,20 @@ NULL
#' ```{asciicast links-file-3}
#' cli_text("... see line 5 in {.file ~/.Rprofile:5}.")
#' ```
#'
#' There is also support for displaying text and line numbers but the syntax
#' is a bit different. You have to use `style_hyperlink()` with `params`.
#' Make sure that `line` and `col` are numeric as they will be ignored otherwise.
#'
#' ```{asciicast links-file-4}
#' link <- style_hyperlink(
#' text = "R profile at line 5",
#' url = "file://~/.Rprofile",
#' params = c(line = 5, col = 1)
#' )
#' cli_text("... see {link}")
#' ```
#'
#' ## Default handler
#'
#' In RStudio `file:` URLs open within RStudio. If you click on a file
Expand All @@ -579,7 +592,7 @@ NULL
#' One issue with using `.href` file files is that it does not look great
#' if hyperlinks are not available. This will be improved in the future:
#'
#' ```{asciicast links-file-4}
#' ```{asciicast links-file-5}
#' local({
#' withr::local_options(cli.hyperlink = FALSE)
#' prof <- path.expand("~/.Rprofile")
Expand Down
Loading