-
Notifications
You must be signed in to change notification settings - Fork 344
Incorrect urls for generated figures with pkgdown 2.0.7-2.0.9 w/ rmarkdown 2.26 #2496
Description
In a private package, a vignette containing code generating plots and figures has long rendered successfully with pkgdown 2.0.7, with the generated article HTML containing tags of the form
<p><img src="vignette_name_files/figure-html/unnamed-chunk-35-1.png">
where vignette_name is a stand-in for the actual vignette name. However, I recently updated the packages in my local R environment, including (but presumably not limited to) pkgdown 2.0.9, released (like 2.0.8) in same month as of writing this post. The rendered HTML now includes broken links of the form
<p><img src="../docs/articles/vignette_name_files/figure-html/unnamed-chunk-31-1.png">
Under the hypothesis that the cause was some change (documented or otherwise) in pkgdown 2.0.8 or 2.0.9, I downgraded my pkgdown version back to 2.0.7; however, the new behavior persisted, and so possibly the cause was in some pkgdown dependency updated alongside pkgdown at the same time I updated to 2.0.9. Here is a list of the versions of all recursive dependencies of pkgdown in my environment:
> packageVersion("pkgdown")[1] ‘2.0.7’
> sapply(packrat:::recursivePackageDependencies("pkgdown", ignore = "", lib.loc = .libPaths()), \(x) as.character(packageVersion(x)), USE.NAMES = TRUE)
R6 askpass base64enc brio bslib cachem callr cli cpp11 curl desc digest downlit evaluate fansi fastmap fontawesome
"2.5.1" "1.2.0" "0.1.3" "1.1.4" "0.7.0" "1.0.8" "3.7.6" "3.6.2" "0.4.7" "5.2.1" "1.4.3" "0.6.35" "0.4.3" "0.23" "1.0.6" "1.1.1" "0.5.2"
fs glue highr htmltools httr jquerylib jsonlite knitr lifecycle magrittr memoise mime openssl pillar pkgconfig processx ps
"1.6.3" "1.7.0" "0.10" "0.5.8.1" "1.4.7" "0.1.4" "1.8.8" "1.46" "1.0.4" "2.0.3" "2.0.1" "0.12" "2.1.2" "1.9.0" "2.0.3" "3.8.4" "1.7.6"
purrr ragg rappdirs rlang rmarkdown sass sys systemfonts textshaping tibble tinytex utf8 vctrs whisker withr xfun xml2
"1.0.2" "1.3.0" "0.3.3" "1.1.3" "2.26" "0.4.9" "3.4.2" "1.0.6" "0.3.7" "3.2.1" "0.50" "1.2.4" "0.6.5" "0.4.1" "3.0.0" "0.43" "1.3.6"
yaml
"2.3.8"
Briefly scanning through the ones that don't look immediately irrelevant, here is an incomplete list of ones whose current version may have been installed after the last time I rendered this vignette successfully:
- knitr 1.46 (three works before the time of writing
- rmarkdown 2.26 (a month and a half before the time of writing)
- htmltools 0.5.8.1 (three weeks before the time of writing)
Update: I downgraded knitr to 1.45 and rmarkdown to 2.25 and this vignette renders successfully, so the issue is with one or both of knitr 1.56 and rmarkdown 2.26. I will attempt to try with either version at a time.
Update 2: I then re-installed rmarkdown 2.26 and the issue appeared again. So, it seems to be either some issue with rmarkdown 2.26 or some interaction between pkgdown (at least 2.0.7 onwards) and this new rmarkdown version:
> tictoc::tic(); pkgdown::build_article("vignette_name"); tictoc::toc()
Reading 'vignettes/vignette_name.Rmd'
Writing 'articles/vignette_name.html'
Warning message:
Missing images in 'vignettes/vignette_name.Rmd':
'../docs/articles/vignette_name_files/figure-html/unnamed-chunk-31-1.png',
'../docs/articles/vignette_name_files/figure-html/unnamed-chunk-32-1.png',
'../docs/articles/vignette_name_files/figure-html/unnamed-chunk-33-1.png',
'../docs/articles/vignette_name_files/figure-html/unnamed-chunk-34-1.png'
ℹ pkgdown can only use images in 'man/figures' and 'vignettes'
511.449 sec elapsed
> packageVersion("knitr")
[1] ‘1.45’
> packageVersion("rmarkdown")
[1] ‘2.26’
> packageVersion("htmltools")
[1] ‘0.5.8.1’
> packageVersion("pkgdown")
[1] ‘2.0.7’
--