rstudio / distill

Distill for R Markdown
https://rstudio.github.io/distill/
Apache License 2.0
422 stars 57 forks source link

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

Open korailR opened 5 years ago

korailR commented 5 years ago

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

rkbauer commented 3 years ago

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/

apreshill commented 3 years ago

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.

rkbauer commented 3 years ago

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!

cderv commented 3 years ago

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()
1+1
3+3

![image](https://user-images.githubusercontent.com/6791940/117669678-75dcee00-b1a7-11eb-8eee-36c63644735b.png)

Hope it helps
falaye-sydney commented 2 years ago

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