From dc02fb2bf95fc2bff08b82fb988c020c4e1620c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 12 Feb 2026 13:02:08 +0100 Subject: [PATCH 1/3] fix: do not autolink code that is in a link --- R/rd-html.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/rd-html.R b/R/rd-html.R index 2b6db2009..e141e3e3d 100644 --- a/R/rd-html.R +++ b/R/rd-html.R @@ -160,7 +160,8 @@ as_html.tag_url <- function(x, ...) { } #' @export as_html.tag_href <- function(x, ...) { - a(flatten_text(x[[2]]), href = flatten_text(x[[1]])) + # don't link since we are in a link + a(flatten_text(x[[2]], auto_link = FALSE), href = flatten_text(x[[1]])) } #' @export as_html.tag_email <- function(x, ...) { From 1661114b3d620f8992e9bc384b413dcb5663cf56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 12 Feb 2026 13:50:41 +0100 Subject: [PATCH 2/3] test: add test for code within href --- tests/testthat/test-rd-html.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/testthat/test-rd-html.R b/tests/testthat/test-rd-html.R index b9fe44395..46e87d843 100644 --- a/tests/testthat/test-rd-html.R +++ b/tests/testthat/test-rd-html.R @@ -319,6 +319,13 @@ test_that("bad specs throw errors", { }) }) +test_that("no autolink in href", { + expect_equal( + rd2html("\\href{https://example.com}{\\code{download.file()}}"), + "download.file()" + ) +}) + # Paragraphs -------------------------------------------------------------- test_that("empty input gives empty output", { From f4a0e9565f4688937d90460a963864449da719ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 12 Feb 2026 13:58:33 +0100 Subject: [PATCH 3/3] news item --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index e5087ea93..29315dae5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # pkgdown (development version) +* do not autolink code that is in a link (href) in Rd files (#2972) + # pkgdown 2.2.0 * Make `build_llm_docs()` more robust to the use of old Pandoc (@nanxstats, @galachad, #2952, #2954)