Skip to content

Commit

Permalink
Support Markdown in custom @family titles (#1608)
Browse files Browse the repository at this point in the history
  • Loading branch information
salim-b authored Jul 9, 2024
1 parent f5374ac commit 12c3555
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions R/rd-family.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/test-rd-family.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 12c3555

Please sign in to comment.