\n\n
(I'll deal with the accessibility issue later.) However, I have the correct figures in man/figures
:
Notice that these are PNG files, so I'm avoiding the issue raised here.
\nAccording to the pkgdown manual, I may need to insert pointers to the files in the vignette's YAML:
\n\n(image from the manual--and why is it showing an example of an image in an
images
folder?)
But I have:
\n\nvignettes
folder.According to the Writing R Extensions Manual, "All other files needed to re-make the vignettes (such as LaTeX style files, BibTeX input files and files for any figures not created by running the code in the vignette) must be in the vignette source directory."
\nI have tried that, too:
\n\nIn case anyone asks, I'm not generating the images during the build process because to make them, GRASS GIS has to be installed. When GH Actions builds the web pages, it would fail because GRASS is not installed on the GH Actions system.
\n","author":{"@type":"Person","name":"Eden"},"upvoteCount":0,"answerCount":1,"acceptedAnswer":null}}Reputation: 458
I am trying to use pkgdown to knit vignettes and have them posted on GitHub, along with the rest of a package's documentation, using GitHub Actions. I can also knit the pages locally. Regardless, external images I want in the vignette are not showing--the "broken image" icon appears instead whether I knit them locally or through GH Actions.
I would love to post a minimally reproducible example, but I have not been able to make a minimal package that can do that. I will instead post a link to the package in the comments because if I can get this fixed, it will no longer be an example of the issue I'm trying to fix.
I'm using pkgdown 2.1.1 on R 4.4.0. I am inserting the images using:

Here is what I have tried.
(I'll deal with the accessibility issue later.) However, I have the correct figures in man/figures
:
Notice that these are PNG files, so I'm avoiding the issue raised here.
According to the pkgdown manual, I may need to insert pointers to the files in the vignette's YAML:
(image from the manual--and why is it showing an example of an image in an
images
folder?)
But I have:
vignettes
folder.According to the Writing R Extensions Manual, "All other files needed to re-make the vignettes (such as LaTeX style files, BibTeX input files and files for any figures not created by running the code in the vignette) must be in the vignette source directory."
I have tried that, too:
In case anyone asks, I'm not generating the images during the build process because to make them, GRASS GIS has to be installed. When GH Actions builds the web pages, it would fail because GRASS is not installed on the GH Actions system.
Upvotes: 0
Views: 88
Reputation: 458
So, here are the solutions to get external images to display in vignettes.
External images in vignettes
To get local, external images to display in vignettes, despite all instruction to the contrary like here and here, I needed to:
a) Save images to ./vignettes/images
; then
b) Refer to them in the vignette's .Rmd
file using links like . The ".
" at the start is important.
External images in vignettes in pkgdown
site built using GitHub Actions
The pkgdown
site is built in a repo named gh-pages
. Switch your branch to that one, and create a subfolder in the articles
folder named reference
, and inside of that, create subfolder named figures
. Copy your figures to there, and it should work.
I have found no documentation of the need to do this, and indeed, would have expected usethis::use_pkgdown_github_pages()
to have set this up to automatically happen.
Upvotes: 0