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
vignette images not loading #172
Comments
|
Exactly how are you calling |
|
I've tried in RStudio, command line R (OSX), via In all cases, the top level of this repo is the working directory and I get absolute file paths in the html as above. Here's a bash script that replicates the problem for me: #!/bin/bash
git clone https://github.com/goldingn/zoon.git
cd zoon
Rscript -e "getwd()"
# Rscript -e "pkgdown::build_site()"
Rscript -e "library(pkgdown); build_site()"
sed '112q;d' docs/reference/articles/Building_a_module.html
cd ..
rm -rf zoonI get the following output (truncated): |
|
Ok, just wanted to check that you weren't calling |
|
great, thanks! |
|
I think this has to do with the use of See discussion in rstudio/rmarkdown#587 It is easy enough to render the HTML in the vignette directory and then move it to path <- rmarkdown::render(
file.path(pkg$path, "vignettes", file_in),
output_format = format$format,
output_file = basename(file_out),
quiet = TRUE,
envir = new.env(parent = globalenv())
)
tweak_rmarkdown_html(path, depth = vig_depth + depth, index = pkg$topics)
vignette_html <- file.path(pkg$path, "vignettes", file_out)
article_html <- file.path(pkg$path, path, file_out)
file.rename(vignette_html, article_html)But if there are PNGs generated during the render, they need to be moved from |
|
I think it'd probably be easier to copy the vignette to the target dir, build there, and then delete. Maybe even better to copy the complete contents of the vignette dir, build, and then delete the Rmds. |
* add missing topic param - so that output filenames are named with topic name rather than "unknown" * copy and build vignettes in docs/articles - fixes #172 * copy everything from vignettes to docs/articles * use purrr::walk
|
|
This is so useful, I can't believe I've only just seen it!
One hiccup; the images in our vignettes don't load, e.g.: http://goldingn.github.io/zoon/articles/Building_a_module.html
That's because the file paths in the html generated by
pkgdown::build_site()are absolute: https://github.com/goldingn/zoon/blob/gh-pages/reference/articles/Building_a_module.html#L187I'm guessing this is because
build_articles()callsrmarkdown::html_document()with the argumentself_contained = FALSE: https://github.com/hadley/pkgdown/blob/master/R/build-articles.R#L96, although it's not clear to me why they get the full filepath rather than relative to whereverbuild_site()is executed.The text was updated successfully, but these errors were encountered: