In short, kaca is a shiny application which captures image or link,
saves it to designated dir and inserts a url. For it is based on shiny
and JavaScript, basically can be used on RStudio in any operating system
(including RStudio Server).
First, you need to set a shortcut key (if you don’t want to run
kaca::kaca() in the console every time), I highly recommend
Ctrl + Alt + C or Ctrl + B (because these two are not commonly used
by other softwares).You can search for Insert pics from clipboard in
the modify keyboard shortcuts of RStudio to find kaca.
Then, assuming there is an image on your clipboard, that’s great! You just need to press the shortcut key you set earlier to save the image and insert a quote. Remember to give your picture a meaningful name.
Because the method used here is image encoding and decoding to obtain and save images, it can’t save animated images on the clipboard. This issue could be partially resolved by using the method of copying links below.
knitr::include_graphics('utils/images/pre1.gif')If there is an image link on your clipboard, you can either directly insert the original link or download it to your local device before inserting a new link. The latter option won’t take much effort.
knitr::include_graphics('utils/images/pre2.gif')Be sure to remember that any images saved locally need to have a
meaningful name, unless you set options('kacaMode' = 'auto'). You can
also set options('kacaMode' = 'semi') to revert back to the initial.
But I believe this setting is generally not needed.
knitr::include_graphics('utils/images/pre3.gif')Now we have image hosting service in R. including github and gitee!
You can use Github Action to reach other services for now.
Use
edit_environ_github/edit_environ_gitee/edit_environ_githubAction
to configure environs. Note that in githubAction we do nothing but to
replace the raw url to provided one, like:
In which, you should designate HOST_SERVICE as github or gitee.
The tutorial on connecting Github Action to Tencent Cloud can be found here, and I have conducted it, which is very convenient for writing Wexin articles.
Add built-in support for other image hosting service.



