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
Vignettes use absolute paths #553
Comments
|
Hmm, there's something inconsistent happening, it seems, because the logo in your article below is definitely relative. |
|
Ignore the one hosted at grunwaldlab.github.io. That was built with the previous iteration of pkgdown. This is the one you want: |
|
Does the view appear the same for you locally (i.e. without htmlpreview)? |
|
Locally, I will get the correct images showing up, but I suspect if I change computers, this will not be true. |
|
I changed how vignettes are built and didn’t have an example of embedding a plot. Oops! I’ll reconsider my approach again. Might be able to fix by setting working directory instead of using output dir, or could try building in vignette dir with temp name and then copying to articles. |
|
Setting the working directory doesn't seem to help. Now trying the copying approach. |
|
Actually, I can't reproduce the problem. I added a new test vignette containing a figure, but I always get a relative path. How are you building the site? |
|
And can you please provide a pointer to the source of the vignette? |
|
I still see abs paths in README and vignettes, see #554 I get the same result calling |
|
Oh the problem is images, not figures. |
|
Hmmm setting |
|
And we can't set I think that implies that we have to build in the directory in which the article lives. We can't even copy that directory because we also have to copy all children, and in the case of To figure out which files we need to copy, maybe we can |
|
Hmmm, that strategy will fail if you're previewing locally. Another idea: copy |
|
Alternatively, since the problem is only images, maybe it's easier to simply add another layer of html tweaking? |
Setting output_path, automatically causes embedded images (but not figures) to get absolute paths. I considered a number of other solutions in #553, and this seems like the tradeoff.
|
Ok, I've resolved the absolute path problem but it reveals a new problem - images in the vignettes directory are not currently copied to the documentation website. Should they be? R does not (unless you list in Maybe a reasonable heuristic is to copy any "image" files found by ... Oh better, |
When images are internal using `knitr::include_graphics`, they are not
copied with pkgdown site. Moreover, copy is not in the same place for
pkgdown and classical vignette to show images.
Here is the workaround:
```{r}
file <- file.path(tmpdir, "Covariate_correlation_crop.png")
silent <- file.copy(file, "Covariate_correlation_crop.png")
if (dir.exists(here::here("docs/articles"))) { # for pkgdown only
silent <- file.copy(file,
here::here("docs/articles/Covariate_correlation_crop.png"))
}
knitr::include_graphics("Covariate_correlation_crop.png")
```
Changes due to modifications in {pkgdown}:
r-lib/pkgdown#553
After updating, I notice that the vignettes/articles are using absolute paths to images instead of relative paths.
case in point: grunwaldlab/poppr@5697ce1#diff-f627caa64acaddf31682a506ff09110dR353
The text was updated successfully, but these errors were encountered: