diff --git a/NEWS.md b/NEWS.md index 5843d931..7a5b0d59 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # roxygen2 (development version) +* Custom [`@family` + titles](https://roxygen2.r-lib.org/articles/index-crossref.html) now support + Markdown syntax (#1608, @salim-b). # roxygen2 7.3.2 * `@includeRmd` now additionally sets `options(cli.hyperlink = FALSE)` to make diff --git a/R/rd-family.R b/R/rd-family.R index df036544..7518674d 100644 --- a/R/rd-family.R +++ b/R/rd-family.R @@ -31,8 +31,7 @@ topics_process_family_prefix <- function(family) { if (is.null(prefix)) return(default) - prefix - + markdown(prefix, tag = "family") } topics_process_family <- function(topics, env) { diff --git a/tests/testthat/test-rd-family.R b/tests/testthat/test-rd-family.R index fb7b8b59..3ee69308 100644 --- a/tests/testthat/test-rd-family.R +++ b/tests/testthat/test-rd-family.R @@ -124,6 +124,22 @@ test_that("custom family prefixes can be set", { expect_match(out$get_value("seealso"), "^Custom prefix:") }) +test_that("custom family prefixes can include Markdown", { + + local_roxy_meta_set("rd_family_title", list(a = "Custom ***strongly emphasized*** prefix: ")) + out <- roc_proc_text(rd_roclet(), " + #' foo + #' @family a + foo <- function() {} + + #' bar + #' @family a + bar <- function() {} + ")[[1]] + + expect_match(out$get_value("seealso"), "^Custom \\\\emph\\{\\\\strong\\{strongly emphasized\\}} prefix:") +}) + test_that("careful ordering", { out <- roc_proc_text(rd_roclet(), " #' foo1