Skip to content

Commit

Permalink
Only do html operations for html vignettes (#2521)
Browse files Browse the repository at this point in the history
This eliminates some warnings that appear when building the pkgdown site itself.
  • Loading branch information
hadley authored May 8, 2024
1 parent 21447ca commit 3e320c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/rmarkdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ render_rmarkdown <- function(pkg, input, output, ..., seed = NULL, copy_images =
path <- inject(rmarkdown_render_with_seed(!!!args))
}

if (identical(path_ext(path)[[1]], "html")) {
is_html <- identical(path_ext(path)[[1]], "html")
if (is_html) {
update_html(
path,
tweak_rmarkdown_html,
Expand All @@ -65,7 +66,7 @@ render_rmarkdown <- function(pkg, input, output, ..., seed = NULL, copy_images =
}

# Copy over images needed by the document
if (copy_images) {
if (copy_images && is_html) {
ext_src <- rmarkdown::find_external_resources(input_path)

# temporarily copy the rendered html into the input path directory and scan
Expand All @@ -88,7 +89,10 @@ render_rmarkdown <- function(pkg, input, output, ..., seed = NULL, copy_images =
dir_create(unique(path_dir(dst)))
file_copy(src, dst, overwrite = TRUE)
}
check_missing_images(pkg, input_path, output)

if (is_html) {
check_missing_images(pkg, input_path, output)
}

invisible(path)
}
Expand Down

0 comments on commit 3e320c8

Please sign in to comment.