From f9803a0cad885873649a5790d2167ddabdbf3da2 Mon Sep 17 00:00:00 2001 From: olivroy <52606734+olivroy@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:49:19 -0400 Subject: [PATCH 1/6] Update footer-configuration.Rmd (#2401) --- man/rmd-fragments/footer-configuration.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/rmd-fragments/footer-configuration.Rmd b/man/rmd-fragments/footer-configuration.Rmd index 6beece61a..900339f7e 100644 --- a/man/rmd-fragments/footer-configuration.Rmd +++ b/man/rmd-fragments/footer-configuration.Rmd @@ -24,7 +24,7 @@ The example below puts the authors' information on the right along with a legal footer: structure: left: pkgdown - right: [authors, legal] + right: [developed_by, legal] components: legal: Provided without **any warranty**. ``` From 2d45e67bc2d7d0d0b9162a1492c5dd847d09f5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Metehan=20G=C3=9CNG=C3=96R?= <102655648+gungorMetehan@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:30:27 +0300 Subject: [PATCH 2/6] Update number of packages that use pkgdownREADME.Rmd (#2399) --- README.Rmd | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.Rmd b/README.Rmd index 9211af9c8..b286a25e4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -69,7 +69,7 @@ Then learn about the many new ways to customise your site in `vignette("customis ## In the wild -At last count, pkgdown is used [by over 8,000 packages](https://github.com/search?q=path%3A_pkgdown.yml+language%3AYAML&type=code&l=YAML). Here are a few examples created by contributors to pkgdown: +At last count, pkgdown is used [by over 11,000 packages](https://github.com/search?q=path%3A_pkgdown.yml+language%3AYAML&type=code&l=YAML). Here are a few examples created by contributors to pkgdown: * [bayesplot](http://mc-stan.org/bayesplot/index.html) ([source](https://github.com/stan-dev/bayesplot/tree/gh-pages)): diff --git a/README.md b/README.md index 8f6acb661..6eb921abd 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Then learn about the many new ways to customise your site in ## In the wild -At last count, pkgdown is used [by over 8,000 +At last count, pkgdown is used [by over 11,000 packages](https://github.com/search?q=path%3A_pkgdown.yml+language%3AYAML&type=code&l=YAML). Here are a few examples created by contributors to pkgdown: From 3dffe220aaf466ff9bdb0aaad7e53ba103f8b85e Mon Sep 17 00:00:00 2001 From: Salim B Date: Mon, 11 Mar 2024 16:30:59 +0100 Subject: [PATCH 3/6] cosmetic style fixes (#2353) --- R/build-reference.R | 13 ++++++++----- R/build.R | 18 +++++++++--------- R/rd-example.R | 3 +-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/R/build-reference.R b/R/build-reference.R index 66a62e23e..3ebb37c22 100644 --- a/R/build-reference.R +++ b/R/build-reference.R @@ -189,7 +189,8 @@ build_reference <- function(pkg = ".", topics <- purrr::transpose(pkg$topics) } - purrr::map(topics, + purrr::map( + topics, build_reference_topic, pkg = pkg, lazy = lazy, @@ -269,8 +270,7 @@ build_reference_topic <- function(topic, pkg, lazy = TRUE, examples_env = globalenv(), - run_dont_run = FALSE - ) { + run_dont_run = FALSE ) { in_path <- path(pkg$src_path, "man", topic$file_in) out_path <- path(pkg$dst_path, "reference", topic$file_out) @@ -297,12 +297,14 @@ build_reference_topic <- function(topic, if (data$has_deps) { deps <- bs_theme_deps_suppress(deps) deps <- htmltools::resolveDependencies(deps) - deps <- purrr::map(deps, + deps <- purrr::map( + deps, htmltools::copyDependencyToDir, outputDir = file.path(pkg$dst_path, "reference", "libs"), mustWork = FALSE ) - deps <- purrr::map(deps, + deps <- purrr::map( + deps, htmltools::makeDependencyRelative, basepath = file.path(pkg$dst_path, "reference"), mustWork = FALSE @@ -326,6 +328,7 @@ data_reference_topic <- function(topic, pkg, examples_env = globalenv(), run_dont_run = FALSE) { + local_context_eval(pkg$figures, pkg$src_path) withr::local_options(list(downlit.rdname = get_rdname(topic))) diff --git a/R/build.R b/R/build.R index f455f9b31..421010fd9 100644 --- a/R/build.R +++ b/R/build.R @@ -415,14 +415,13 @@ build_site_external <- function(pkg = ".", } build_site_local <- function(pkg = ".", - examples = TRUE, - run_dont_run = FALSE, - seed = 1014, - lazy = FALSE, - override = list(), - preview = NA, - devel = TRUE - ) { + examples = TRUE, + run_dont_run = FALSE, + seed = 1014, + lazy = FALSE, + override = list(), + preview = NA, + devel = TRUE) { pkg <- section_init(pkg, depth = 0, override = override) @@ -433,7 +432,8 @@ build_site_local <- function(pkg = ".", init_site(pkg) build_home(pkg, override = override, preview = FALSE) - build_reference(pkg, + build_reference( + pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, diff --git a/R/rd-example.R b/R/rd-example.R index ee54d2cf9..8738150d5 100644 --- a/R/rd-example.R +++ b/R/rd-example.R @@ -13,8 +13,7 @@ rd2ex <- function(x, ...) { run_examples <- function(x, topic = "unknown", env = globalenv(), - run_dont_run = FALSE - ) { + run_dont_run = FALSE) { if (!inherits(x, "tag")) { x <- rd_text(x) From 146c2accf134dfc8c96890af08a91978c396a092 Mon Sep 17 00:00:00 2001 From: dmurdoch Date: Mon, 11 Mar 2024 11:33:18 -0400 Subject: [PATCH 4/6] Put selector functions etc. into a parent env (#2397) Fixes #2396 --- NEWS.md | 1 + R/topics.R | 19 +++++++------ .../testthat/_snaps/build-reference-index.md | 28 +++++++++++++++++++ .../assets/reference-selector/DESCRIPTION | 6 ++++ .../assets/reference-selector/NAMESPACE | 4 +++ .../assets/reference-selector/R/funs.R | 7 +++++ .../assets/reference-selector/_pkgdown.yml | 1 + .../assets/reference-selector/man/A.Rd | 11 ++++++++ .../assets/reference-selector/man/matches.Rd | 11 ++++++++ tests/testthat/test-build-reference-index.R | 10 +++++++ 10 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 tests/testthat/assets/reference-selector/DESCRIPTION create mode 100644 tests/testthat/assets/reference-selector/NAMESPACE create mode 100644 tests/testthat/assets/reference-selector/R/funs.R create mode 100644 tests/testthat/assets/reference-selector/_pkgdown.yml create mode 100644 tests/testthat/assets/reference-selector/man/A.Rd create mode 100644 tests/testthat/assets/reference-selector/man/matches.Rd diff --git a/NEWS.md b/NEWS.md index 169fd5c3e..11a8232b2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ * Add Catalan translation (@jmaspons, #2333) * Set RNG seed for htmlwidgets IDs. This reduces noise in pkgdown reference HTML output when examples generate htmlwidgets (@salim-b, #2294). * Fix BS5 navbar template to get `navbar.type: dark` to work with bslib 0.6+ / Bootstrap 5.3+ (@tanho63, #2388) +* Topic names that conflict with selector functions can now be listed as references in `_pkgdown.yml` (@dmurdoch, #2397). # pkgdown 2.0.7 diff --git a/R/topics.R b/R/topics.R index b135eb3bc..9bf17c9fa 100644 --- a/R/topics.R +++ b/R/topics.R @@ -61,10 +61,11 @@ all_sign <- function(x, text) { } match_env <- function(topics) { - out <- env(empty_env(), + fns <- env(empty_env(), "-" = function(x) -x, "c" = function(...) c(...) ) + out <- env(fns) topic_index <- seq_along(topics$name) @@ -99,36 +100,36 @@ match_env <- function(topics) { is_public <- function(internal) { if (!internal) !topics$internal else rep(TRUE, nrow(topics)) } - out$starts_with <- function(x, internal = FALSE) { + fns$starts_with <- function(x, internal = FALSE) { any_alias(~ grepl(paste0("^", x), .), .internal = internal) } - out$ends_with <- function(x, internal = FALSE) { + fns$ends_with <- function(x, internal = FALSE) { any_alias(~ grepl(paste0(x, "$"), .), .internal = internal) } - out$matches <- function(x, internal = FALSE) { + fns$matches <- function(x, internal = FALSE) { any_alias(~ grepl(x, .), .internal = internal) } - out$contains <- function(x, internal = FALSE) { + fns$contains <- function(x, internal = FALSE) { any_alias(~ grepl(x, ., fixed = TRUE), .internal = internal) } - out$has_keyword <- function(x) { + fns$has_keyword <- function(x) { which(purrr::map_lgl(topics$keywords, ~ any(. %in% x))) } - out$has_concept <- function(x, internal = FALSE) { + fns$has_concept <- function(x, internal = FALSE) { match <- topics$concepts %>% purrr::map(~ str_trim(.) == x) %>% purrr::map_lgl(any) which(match & is_public(internal)) } - out$lacks_concepts <- function(x, internal = FALSE) { + fns$lacks_concepts <- function(x, internal = FALSE) { nomatch <- topics$concepts %>% purrr::map(~ match(str_trim(.), x, nomatch = FALSE)) %>% purrr::map_lgl(~ length(.) == 0L | all(. == 0L)) which(nomatch & is_public(internal)) } - out$lacks_concept <- out$lacks_concepts + fns$lacks_concept <- fns$lacks_concepts out } diff --git a/tests/testthat/_snaps/build-reference-index.md b/tests/testthat/_snaps/build-reference-index.md index 13a43f0e2..c19370cb5 100644 --- a/tests/testthat/_snaps/build-reference-index.md +++ b/tests/testthat/_snaps/build-reference-index.md @@ -157,3 +157,31 @@ has_icons: no +# can use a selector name as a topic name + + Code + data_reference_index(pkg) + Output + pagetitle: Function reference + rows: + - title: bla + slug: bla + desc: ~ + is_internal: no + - topics: + - path: matches.html + title: matches + aliases: matches() + icon: ~ + - path: A.html + title: A + aliases: A() + icon: ~ + names: + - matches + - A + row_has_icons: no + is_internal: no + has_icons: no + + diff --git a/tests/testthat/assets/reference-selector/DESCRIPTION b/tests/testthat/assets/reference-selector/DESCRIPTION new file mode 100644 index 000000000..49c062aca --- /dev/null +++ b/tests/testthat/assets/reference-selector/DESCRIPTION @@ -0,0 +1,6 @@ +Package: testpackage +Version: 1.0.0 +Title: A test package +Description: A test package +Authors@R: person("Hadley Wickham") +RoxygenNote: 7.3.1 diff --git a/tests/testthat/assets/reference-selector/NAMESPACE b/tests/testthat/assets/reference-selector/NAMESPACE new file mode 100644 index 000000000..7a3c4d864 --- /dev/null +++ b/tests/testthat/assets/reference-selector/NAMESPACE @@ -0,0 +1,4 @@ +# Generated by roxygen2: do not edit by hand + +export(A) +export(matches) diff --git a/tests/testthat/assets/reference-selector/R/funs.R b/tests/testthat/assets/reference-selector/R/funs.R new file mode 100644 index 000000000..201dcc993 --- /dev/null +++ b/tests/testthat/assets/reference-selector/R/funs.R @@ -0,0 +1,7 @@ +#' matches +#' @export +matches <- function() {} + +#' A +#' @export +A <- function() {} diff --git a/tests/testthat/assets/reference-selector/_pkgdown.yml b/tests/testthat/assets/reference-selector/_pkgdown.yml new file mode 100644 index 000000000..86939d57a --- /dev/null +++ b/tests/testthat/assets/reference-selector/_pkgdown.yml @@ -0,0 +1 @@ +url: http://test.org diff --git a/tests/testthat/assets/reference-selector/man/A.Rd b/tests/testthat/assets/reference-selector/man/A.Rd new file mode 100644 index 000000000..48ec60217 --- /dev/null +++ b/tests/testthat/assets/reference-selector/man/A.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/funs.R +\name{A} +\alias{A} +\title{A} +\usage{ +A() +} +\description{ +A +} diff --git a/tests/testthat/assets/reference-selector/man/matches.Rd b/tests/testthat/assets/reference-selector/man/matches.Rd new file mode 100644 index 000000000..693b742e9 --- /dev/null +++ b/tests/testthat/assets/reference-selector/man/matches.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/funs.R +\name{matches} +\alias{matches} +\title{matches} +\usage{ +matches() +} +\description{ +matches +} diff --git a/tests/testthat/test-build-reference-index.R b/tests/testthat/test-build-reference-index.R index 59ef31855..2899f2e6f 100644 --- a/tests/testthat/test-build-reference-index.R +++ b/tests/testthat/test-build-reference-index.R @@ -126,3 +126,13 @@ test_that("can use a topic from another package", { expect_snapshot(data_reference_index(pkg)) }) + +test_that("can use a selector name as a topic name", { + meta <- list(reference = list(list( + title = "bla", + contents = c("matches", "matches('A')") + ))) + pkg <- as_pkgdown(test_path("assets/reference-selector"), override = meta) + + expect_snapshot(data_reference_index(pkg)) +}) From 504d01999a3d0f8644a6e86e538dee1bbae32689 Mon Sep 17 00:00:00 2001 From: olivroy <52606734+olivroy@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:34:14 -0400 Subject: [PATCH 5/6] Tweaks in error chaining and path display (#2403) * cli fixes * Fix chaining in `check_pkgdown()` + add hyperlink to `_pkgdown.yml` in error message. * Actually show snapshot by using `cli_inform()` instead of `cli_alert_success()`. * Remove unrelated changes --- R/build-articles.R | 3 ++- R/build-favicons.R | 7 ++----- R/build-reference-index.R | 16 ++++++++-------- R/build.R | 6 +++--- R/check.R | 5 +++-- R/package.R | 6 ++++++ tests/testthat/_snaps/build-reference-index.md | 4 ++-- tests/testthat/_snaps/check.md | 6 ++++-- 8 files changed, 30 insertions(+), 23 deletions(-) diff --git a/R/build-articles.R b/R/build-articles.R index ceb406d93..d434233ad 100644 --- a/R/build-articles.R +++ b/R/build-articles.R @@ -371,7 +371,8 @@ data_articles_index <- function(pkg = ".") { if (length(missing) > 0) { cli::cli_abort( - "{length(missing)} vignette{?s} missing from index: {.file {missing}}.", + "{length(missing)} vignette{?s} missing from index in \\ + {pkgdown_config_href({pkg$src_path})}: {.val {missing}}.", call = caller_env() ) } diff --git a/R/build-favicons.R b/R/build-favicons.R index 066f4dfb7..ed137c686 100644 --- a/R/build-favicons.R +++ b/R/build-favicons.R @@ -32,7 +32,7 @@ build_favicons <- function(pkg = ".", overwrite = FALSE) { if (has_favicons(pkg) && !overwrite) { cli::cli_inform(c( "Favicons already exist in {.path pkgdown}", - "i" = "Set {.var overwrite = TRUE} to re-create." + "i" = "Set {.code overwrite = TRUE} to re-create." )) return(invisible()) } @@ -78,10 +78,7 @@ build_favicons <- function(pkg = ".", overwrite = FALSE) { result <- content$favicon_generation_result if (!identical(result$result$status, "success")) { - cli::cli_abort(c( - "API request failed.", - "i" = "{.href [Please submit a bug report](https://github.com/r-lib/pkgdown/issues)}" - )) + cli::cli_abort("API request failed.", .internal = TRUE) } tmp <- tempfile() diff --git a/R/build-reference-index.R b/R/build-reference-index.R index 1e0c3dfce..0abdd661a 100644 --- a/R/build-reference-index.R +++ b/R/build-reference-index.R @@ -1,4 +1,4 @@ -data_reference_index <- function(pkg = ".") { +data_reference_index <- function(pkg = ".", error_call = caller_env()) { pkg <- as_pkgdown(pkg) meta <- pkg$meta[["reference"]] %||% default_reference_index(pkg) @@ -13,7 +13,7 @@ data_reference_index <- function(pkg = ".") { has_icons <- purrr::some(rows, ~ .x$row_has_icons %||% FALSE) - check_missing_topics(rows, pkg) + check_missing_topics(rows, pkg, error_call = error_call) rows <- Filter(function(x) !x$is_internal, rows) print_yaml(list( @@ -125,7 +125,7 @@ default_reference_index <- function(pkg = ".") { )) } -check_missing_topics <- function(rows, pkg) { +check_missing_topics <- function(rows, pkg, error_call = caller_env()) { # Cross-reference complete list of topics vs. topics found in index page all_topics <- rows %>% purrr::map("names") %>% unlist(use.names = FALSE) in_index <- pkg$topics$name %in% all_topics @@ -133,11 +133,11 @@ check_missing_topics <- function(rows, pkg) { missing <- !in_index & !pkg$topics$internal if (any(missing)) { - topics <- paste0(pkg$topics$name[missing], collapse = ", ") - abort(c( + cli::cli_abort(c( "All topics must be included in reference index", - `x` = paste0("Missing topics: ", topics), - i = "Either add to _pkgdown.yml or use @keywords internal" - )) + "x" = "Missing topics: {pkg$topics$name[missing]}", + i = "Either add to {pkgdown_config_href({pkg$src_path})} or use @keywords internal" + ), + call = error_call) } } diff --git a/R/build.R b/R/build.R index 421010fd9..7050861bb 100644 --- a/R/build.R +++ b/R/build.R @@ -408,7 +408,7 @@ build_site_external <- function(pkg = ".", timeout = getOption('pkgdown.timeout', Inf) ) - cli::cli_rule(paste0("Finished building pkgdown site for package ", cli::col_blue(pkg$package))) + cli::cli_rule("Finished building pkgdown site for package {.pkg {pkg$package}}") preview_site(pkg, preview = preview) invisible() @@ -425,7 +425,7 @@ build_site_local <- function(pkg = ".", pkg <- section_init(pkg, depth = 0, override = override) - cli::cli_rule(paste0("Building pkgdown site for package ", cli::col_blue(pkg$package))) + cli::cli_rule("Building pkgdown site for package {.pkg {pkg$package}}") cli::cli_inform("Reading from: {src_path(path_abs(pkg$src_path))}") cli::cli_inform("Writing to: {dst_path(path_abs(pkg$dst_path))}") @@ -453,6 +453,6 @@ build_site_local <- function(pkg = ".", build_search(pkg, override = override) } - cli::cli_rule(paste0("Finished building pkgdown site for package ", cli::col_blue(pkg$package))) + cli::cli_rule("Finished building pkgdown site for package {.pkg {pkg$package}}") preview_site(pkg, preview = preview) } diff --git a/R/check.R b/R/check.R index 49a1154df..1858ab454 100644 --- a/R/check.R +++ b/R/check.R @@ -12,6 +12,7 @@ check_pkgdown <- function(pkg = ".") { data_articles_index(pkg) data_reference_index(pkg) - cli::cli_alert_success("No problems found in {.file {pkgdown_config_relpath(pkg)}}") + cli::cli_inform(c( + "v" = "No problems found in {pkgdown_config_href({pkg$src_path})}" + )) } - diff --git a/R/package.R b/R/package.R index 415baf2ef..dfaa04659 100644 --- a/R/package.R +++ b/R/package.R @@ -129,6 +129,12 @@ pkgdown_config_path <- function(path) { ) ) } +pkgdown_config_href <- function(path) { + cli::style_hyperlink( + text = "_pkgdown.yml", + url = paste0("file://", pkgdown_config_path(path)) + ) +} read_meta <- function(path) { path <- pkgdown_config_path(path) diff --git a/tests/testthat/_snaps/build-reference-index.md b/tests/testthat/_snaps/build-reference-index.md index c19370cb5..726ce3988 100644 --- a/tests/testthat/_snaps/build-reference-index.md +++ b/tests/testthat/_snaps/build-reference-index.md @@ -50,9 +50,9 @@ Code data_reference_index(pkg) Condition - Error in `check_missing_topics()`: + Error: ! All topics must be included in reference index - x Missing topics: c, e, ? + x Missing topics: c, e, and ? i Either add to _pkgdown.yml or use @keywords internal # errors well when a content entry is empty diff --git a/tests/testthat/_snaps/check.md b/tests/testthat/_snaps/check.md index d90010d88..f1e4bb125 100644 --- a/tests/testthat/_snaps/check.md +++ b/tests/testthat/_snaps/check.md @@ -3,7 +3,7 @@ Code check_pkgdown(pkg) Condition - Error in `check_missing_topics()`: + Error in `check_pkgdown()`: ! All topics must be included in reference index x Missing topics: ? i Either add to _pkgdown.yml or use @keywords internal @@ -14,10 +14,12 @@ check_pkgdown(pkg) Condition Error in `check_pkgdown()`: - ! 2 vignettes missing from index: 'articles/nested' and 'width'. + ! 2 vignettes missing from index in _pkgdown.yml: "articles/nested" and "width". # informs if everything is ok Code check_pkgdown(pkg) + Message + v No problems found in _pkgdown.yml From b04d5c9516090da514b566167d8b394b0d14521d Mon Sep 17 00:00:00 2001 From: "Carl A. B. Pearson" Date: Mon, 11 Mar 2024 11:37:13 -0400 Subject: [PATCH 6/6] Link issues/users at line starts (take two) (#2374) Fixes #2030 (not creating links at line starts) while not breaking #2122, for most common use case. --- NEWS.md | 1 + R/repo.R | 4 ++-- tests/testthat/test-repo.R | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 11a8232b2..175d784eb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # pkgdown (development version) +* Fix parsing of github profiles and issues into links when present at the beginning of list items (@pearsonca, #2122) * Correct parse usage for S3 methods with non-syntactic class names (#2384). * Deprecated `build_favicon()` was removed (`build_favicons()` remains). diff --git a/R/repo.R b/R/repo.R index 9229780b5..6342051bc 100644 --- a/R/repo.R +++ b/R/repo.R @@ -38,12 +38,12 @@ repo_auto_link <- function(pkg, text) { if (!is.null(url$user)) { user_link <- paste0("\\1@\\2") - text <- gsub("(\\s|^|\\()@([-\\w]+)", user_link, text, perl = TRUE) + text <- gsub("(p>|\\s|^|\\()@([-\\w]+)", user_link, text, perl = TRUE) } if (!is.null(url$issue)) { issue_link <- paste0("#\\2") - text <- gsub("(\\(|\\s)#(\\d+)", paste0("\\1", issue_link), text, perl = TRUE) + text <- gsub("(p>|\\(|\\s)#(\\d+)", paste0("\\1", issue_link), text, perl = TRUE) if (!is.null(pkg$repo$jira_projects)) { issue_link <- paste0("\\1\\2") diff --git a/tests/testthat/test-repo.R b/tests/testthat/test-repo.R index 14122ee34..bd7c1ec76 100644 --- a/tests/testthat/test-repo.R +++ b/tests/testthat/test-repo.R @@ -10,12 +10,21 @@ test_that("authors are automatically linked", { expect_equal(repo_auto_link(pkg, "@y"), "@y") expect_equal(repo_auto_link(pkg, " @y"), " @y") expect_equal(repo_auto_link(pkg, "(@y)"), "(@y)") + + expect_equal(repo_auto_link(pkg, "

@y some other text.

"), "

@y some other text.

") }) test_that("issues are automatically linked", { pkg <- list(repo = repo_meta(issue = "TEST/")) expect_equal(repo_auto_link(pkg, "(#123"), "(#123") expect_equal(repo_auto_link(pkg, "in #123"), "in #123") + expect_equal(repo_auto_link(pkg, "

#123 some other text.

"), "

#123 some other text.

") + expect_equal(repo_auto_link(pkg, "

#123

"), "

#123

") +}) + +test_that("already linked issues aren't re-linked", { + pkg <- list(repo = repo_meta(issue = "TEST/")) + expect_equal(repo_auto_link(pkg, "

#123

"), "

#123

") }) test_that("URLs with hash (#) are preserved", {