-
-
Notifications
You must be signed in to change notification settings - Fork 872
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
Impact of warning on absolute paths for include_graphics()
#2119
Comments
Sorry about the trouble! As I said in #2063 (review), I'm willing to revert this change, and I'm also happy to provide an option to suppress the warning.
I recommend against using functions like |
Appreciate the conversation! Our workflow has a common directory Taking the absolute path and back-converting to a relative path was one option I've been thinking about, but that requires touching a lot of code and, in the case of |
Have just run into this issue as well! So one additional vote in favor of silencing the warning. The |
For sure I'll silence the warning by default in the next version. I'm currently busy with another thing, and will come back to this issue as soon as possible. I really appreciate your feedback! |
I've changed the behavior of this function. Now it will try to automatically convert absolute paths to relative paths. The warning will be issued only if any absolute path cannot be converted. You may test the development version via remotes::install_github('yihui/knitr') I guess that should solve the problem in most cases, and I'm also open to silencing the warning by default. You can set |
…nly if the conversion to relative paths fails if users never want the warning, it can be suppressed via the argument rel_path = FALSE
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
Following the recent change to
include_graphics()
I'm regrettably the squeaky wheel for whom #2063 (review) is very inconvenient/annoying. 😉My team's image work flow involves a custom function that takes a ggplot image, does some external processing and mutliple file creation, returning an absolute file path to the notebook-ready image to be included in the Rmd file. We then pipe this into
include_graphics()
for inline display and knitting purposes. With this change, we get a warning on every image we include, and our notebooks have dozens, if not hundreds of images. It's rather maddening.I suspect the motivation is to encourage relative paths for direct use of
include_graphics()
, helping to ensure portability of code. This doesn't take into account users that are programmatically creating paths at run/knit-time, such as the use ofhere()
which take care of the relative directory issue already.If this change needs to be kept in, can it please be configurable via an options setting? The current knitr release is very frustrating for our flow. Thanks for the dialog!
The text was updated successfully, but these errors were encountered: