Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Imports:
openssl,
purrr (>= 1.0.0),
ragg (>= 1.4.0),
rdtools,
rlang (>= 1.1.4),
rmarkdown (>= 2.27),
tibble,
Expand All @@ -64,6 +65,8 @@ Suggests:
sass,
testthat (>= 3.1.3),
tools
Remotes:
r-lib/rdtools
VignetteBuilder:
knitr,
quarto
Expand Down
24 changes: 12 additions & 12 deletions R/topics-external.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ ext_topics <- function(match_strings) {
)
}

# Adapted from roxygen2::get_rd_from_help
# Fetches the parsed Rd for an external package's topic
get_rd_from_help <- function(package, alias) {
call <- quote(build_reference_index())
check_installed(package, "as it's used in the reference index.", call = call)

help <- utils::help((alias), (package))
if (length(help) == 0) {
fun <- paste0(package, "::", alias)
cli::cli_abort(
"Could not find documentation for {.fn {fun}}.",
call = call
)
return()
}
rd <- tryCatch(
rdtools::topic_rd(alias, package),
error = function(e) {
fun <- paste0(package, "::", alias)
cli::cli_abort(
"Could not find documentation for {.fn {fun}}.",
call = call
)
}
)

out <- get(".getHelpFile", envir = asNamespace("utils"))(help)
set_classes(out)
set_classes(rd)
}
Loading