distill icon indicating copy to clipboard operation
distill copied to clipboard

Copy to clipboard buttons for R Markdown HTML documents in a distill article

Open korailR opened this issue 6 years ago • 5 comments

Hello, I would like to insert a copy to clipboard buttons for R Markdown HTML Documents from the klippy package. It works in a R Markdown document, but not in a distill article. What do I need to set up? Here is the link to the klippy package: https://github.com/RLesur/klippy. Best regards

korailR avatar Apr 21 '19 17:04 korailR

I am not sure if this issue has been addressed yet, but I am wondering how it has been implemented in the website below, which is listed as example-distill website in the documentation (https://rstudio.github.io/distill/website.html#example-themes):

https://www.tidymodels.org/learn/statistics/tidy-analysis/

rkbauer avatar May 08 '21 05:05 rkbauer

No this is not implemented in distill, but above we linked to other ways to get there. The example theme is a color palette inspired by tidymodels.org + and their pkgdown sites, but the main site is built with blogdown. You can see this screenshot is a distill site: https://rstudio.github.io/distill/website.html?panelset3=screenshot3#example-themes

I'll clarify the docs on this.

apreshill avatar May 08 '21 13:05 apreshill

ok. so it's not yet implemented and there are no work-arrounds yet, only if I choose another package to build my website, like pkgdown or blogdown, or did I miss anything? Many thanks!

rkbauer avatar May 09 '21 06:05 rkbauer

Hi,

this is not by default a feature of distill but you can use an existing extension. klippy may not work but for example, xaringanExtra offers another option by bundling clipboard.js. See https://pkg.garrickadenbuie.com/xaringanExtra/#/clipboard Despite the name, xaringanExtra html dependencies can often be used with other type of document. In this case it will work with distill article

---
title: "Untitled"
output: 
  distill::distill_article: default
---

```{r xaringanExtra-clipboard, echo=FALSE}
xaringanExtra::use_clipboard()
```

```{r}
1+1
3+3
```

image

Hope it helps

cderv avatar May 10 '21 13:05 cderv

Gratitude cderv the xaringanExtra::use_clipboard() you suggested was supper helpful for me.

falaye-sydney avatar Mar 19 '22 08:03 falaye-sydney