-
Notifications
You must be signed in to change notification settings - Fork 336
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
Fix up knitr paths relative to the output directory #2502
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - this fixes the gganimate website and, I assume, other sites relying on gganimate
About this, my understanding is the following
This could lead to both input and output relative resources.
Clearly something to fix in knitr and/or rmarkdown |
This may also be a breakage in rmarkdown 2.26. Absolute paths in HTML using output directory should have been made relative by It should be fix soon and we'll do a patch release. |
@cderv I think this problem is separate (if related), because it's a long standing issue. |
Oh ok. From my quick tries of the examples of the two issues, I was really under the impression that the path handling absolute to relative to output-dir should have been handled by markdown post-processing. I'll recheck no matter the state of this PR to be sure there is nothing hidden in R Markdown or knitr |
And resolve issue with using tempdir
Awesome, thanks @cderv! |
@cderv the windows failure is interesting — knitr certainly shouldn't be generating a path like |
So I looked closer into all the examples in pkgdown issue and the problem we have in knitr. Considering that the 2.26 regression is fixed (rstudio/rmarkdown#2554), we are left with issue of I do believe that setting This relative path processing is unaware of the full rendering context enough to do the right work. It will only make path relative to the input directory, and so do not account for usage of pkgdown makes this issue surface because it uses absolute path for input and output in its call to Also when
All comes to
I'll try a forked version of this PR to verify my understanding of this. |
FWIW my test in #2508 is successful after a few tries. Two things are needed to solve all issues
Remaining CI failure here seems unrelated to rmarkdown / knitr path handling |
Works around yihui/knitr#2171 Fixes r-lib#2334. Fixes r-lib#2341.
For some unknown reason,
knitr_print()
methods sometimes produces paths are relative to the input directory, rather than to the output directory. This PR re-parents those to paths to be relative to the output directory making them work again.Fixes #2334. Fixes #2341.
@thomasp85 would you mind checking that this fixes the gganimate site?
(To do: add a test so I don't accidentally break this again in the future)