Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rlesur/klippy

Copy to Clipboard Buttons for RMarkdown HTML Documents
https://github.com/rlesur/klippy

clipboard-buttons knitr r rmarkdown

Last synced: 3 days ago
JSON representation

Copy to Clipboard Buttons for RMarkdown HTML Documents

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# klippy
Copy to Clipboard Buttons for R Markdown HTML Documents

[![Travis build status](https://travis-ci.org/RLesur/klippy.svg?branch=master)](https://travis-ci.org/RLesur/klippy)

## Overview

**klippy** enhances R Markdown HTML documents with **"copy to clipboard" buttons** as shown below:

![](man/figures/klippy.png)

## Installation

`klippy` is not available from CRAN, but you can install the development version from GitHub with:

```{r, eval = FALSE}
# install.packages("remotes")
remotes::install_github("rlesur/klippy")
```

## Motivation

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.

## Usage

Add the following chunk anywhere in your `Rmd` file:

````markdown
`r ''````{r klippy, echo=FALSE, include=TRUE}
klippy::klippy()
```
````

## Browser Support

**klippy** uses [clipboard.js](https://clipboardjs.com/). Tooltips are rendered with [Primer Tooltips](https://primer.style/) CSS.
Glue code is in Vanilla JS.
For supported browsers, see [`clipboard.js` documentation](https://clipboardjs.com/#browser-support).

## Bugs/Feature requests

If you have any, [let me know](https://github.com/RLesur/klippy/issues). Thanks!

## Related project

To use `clipboard.js` in Shiny, see **rclipboard** ([CRAN](https://cran.r-project.org/package=rclipboard), [GitHub](https://github.com/sbihorel/rclipboard)).

## Credits

The following libraries are distributed with `klippy`:

**clipboard.js** (version: 1.7.1) (c) Zeno Rocha
MIT license:
Website:
GitHub:

**Primer Tooltips** (version: 1.4.0) (c) GitHub, Inc.
MIT license:
Website:

The clipboard icon `clippy.svg` is part of:
**GitHub Octicons** (version: 6.0.1) (c) GitHub, Inc.
MIT license:
Website: