Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String "vignettes" in path to static images get replaced by "articles" #2810

Closed
renozao opened this issue Nov 7, 2024 · 2 comments
Closed

Comments

@renozao
Copy link
Contributor

renozao commented Nov 7, 2024

The issue:

  • under vignettes/: an file a_file.Rmd, with a chunk that includes a static image
knitr::include_graphics("../man/figures/vignettes/a/b/c/image.png")
  • a static image file under man/figures/vignettes/a/b/c/image.png

When building the site, I get the warning:

Missing images in vignettes/a_file.Rmd:
../reference/figures/articles/a/b/c/image.png
ℹ pkgdown can only use images in man/figures and vignettes
  • The generated HTML source indeed refers to ../reference/figures/articles/a/b/c/image.png
  • But, the actual image has been copied under ../reference/figures/vignettes/a/b/c/image.png

The cause:

Hence, it looks like there is some string substitution happening, which replaces "vignettes" by "articles", which in this case is incorrect or at least not consistent with where the image files are copied to.
I believe this happens here:

x <- gsub("(^|/)vignettes/", "\\1articles/", x, perl = TRUE)

@jayhesselberth
Copy link
Collaborator

I think you could just change the name of your directory to not include the word "vignettes", correct?

@renozao
Copy link
Contributor Author

renozao commented Dec 2, 2024

Thanks @jayhesselberth. Of course this would be a work-around and exactly what I did.
One may consider though that, if fixing this issue is not planned, then one may want to mention and document the caveat somewhere for the lambda user. The info message is misleading in that case and only when digging into the code one can spot what the actual problem is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants