Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd knit_print method for webshot #27
Conversation
|
I think you can avoid importing knitr. See https://github.com/ramnathv/htmlwidgets/blob/master/R/knitr-methods.R for an example. |
|
I actually had seen that code when I was doing this originally, thought you might not want the added complexity. 8ae7e27 keeps knitr in Suggests and uses the referenced functions. |
| S3method(print,webshot) | ||
| export("%>%") | ||
| export(appshot) | ||
| export(install_phantomjs) | ||
| export(knit_print.webshot) |
yihui
Aug 19, 2016
Collaborator
I guess this does not need to be exported.
I guess this does not need to be exported.
|
Could you also update the functions in image.R to check for the webshot class and also return a filename with that class? Otherwise, I think that doing something like |
|
@wch Ok both shrink and resize now also return webshot objects as well. |
|
Thanks! |
This lets you include
webshot()calls directly in knitted documents and automatically show the output image.The object must be returned visibly in order to show up when knitting, so I had to define a print method as well to preserve the previous behavior.