Skip to content

Commit 12c3555

Browse files
authored
Support Markdown in custom @family titles (#1608)
1 parent f5374ac commit 12c3555

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# roxygen2 (development version)
22

3+
* Custom [`@family`
4+
titles](https://roxygen2.r-lib.org/articles/index-crossref.html) now support
5+
Markdown syntax (#1608, @salim-b).
36
# roxygen2 7.3.2
47

58
* `@includeRmd` now additionally sets `options(cli.hyperlink = FALSE)` to make

R/rd-family.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ topics_process_family_prefix <- function(family) {
3131
if (is.null(prefix))
3232
return(default)
3333

34-
prefix
35-
34+
markdown(prefix, tag = "family")
3635
}
3736

3837
topics_process_family <- function(topics, env) {

tests/testthat/test-rd-family.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,22 @@ test_that("custom family prefixes can be set", {
124124
expect_match(out$get_value("seealso"), "^Custom prefix:")
125125
})
126126

127+
test_that("custom family prefixes can include Markdown", {
128+
129+
local_roxy_meta_set("rd_family_title", list(a = "Custom ***strongly emphasized*** prefix: "))
130+
out <- roc_proc_text(rd_roclet(), "
131+
#' foo
132+
#' @family a
133+
foo <- function() {}
134+
135+
#' bar
136+
#' @family a
137+
bar <- function() {}
138+
")[[1]]
139+
140+
expect_match(out$get_value("seealso"), "^Custom \\\\emph\\{\\\\strong\\{strongly emphasized\\}} prefix:")
141+
})
142+
127143
test_that("careful ordering", {
128144
out <- roc_proc_text(rd_roclet(), "
129145
#' foo1

0 commit comments

Comments
 (0)