klippy enhances R Markdown HTML documents with “copy to clipboard” buttons as shown below:
klippy
is not available from CRAN, but you can install the development
version from GitHub with:
# install.packages("remotes")
remotes::install_github("rlesur/klippy")
As an intensive reader of R Markdown books and documents (thanks to
knitr
), I selected on my screen dozens of R code blocks then press
Ctrl+C
…
This package is a very small, but I hope helpful add-in for R Markdown
to improve the reader experience.
Add the following chunk anywhere in your Rmd
file:
```{r klippy, echo=FALSE, include=TRUE}
klippy::klippy()
```
The klippy
package uses clipboard.js.
Tooltips are rendered with
Primer Tooltips.
Glue code is in Vanilla JS. For supported browsers, see clipboard.js
documentation.
If you have any, let me know. Thanks!
To use clipboard.js
in Shiny, see rclipboard
(CRAN,
GitHub).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.