gadenbuie / xaringanExtra

:ferris_wheel: A playground of enhancements and extensions for xaringan slides.
https://pkg.garrickadenbuie.com/xaringanExtra
Other
448 stars 36 forks source link

Copy-to-clipboard support for code chunks in xaringan #20

Closed mattwarkentin closed 4 years ago

mattwarkentin commented 4 years ago

Hey Garrick,

I originally posted this issue in klippy, but it seems like it may be equally or more so a xaringan/remark issue, so I decided to cross-post it here. Feel free to close this issue if you think this isn't strictly relevant.

I use xaringan slides for teaching and workshops and it would be great to allow students/attendees to be able copy code to clipboard for easy use of any code used in the slides. It can also be useful even just for the presenter, if they want to turn a presentation of code into a live-coding demo.

RLesur/klippy#16

gadenbuie commented 4 years ago

@mattwarkentin Thanks for the suggestion. I think this is a good fit for xaringanExtra! I'll look into it.

https://clipboardjs.com/

mattwarkentin commented 4 years ago

So excited to test this out! This is a huge UX upgrade for xaringan IMO.

gadenbuie commented 4 years ago

Thanks! I'm pretty happy with how this one turned out, I haven't tested it extensively in all R Markdown outputs but I think it will work just about anywhere 😄

Let me know how it goes when you take it for a spin!

mattwarkentin commented 4 years ago

Tried it out and it works great. No issues to report. Dropped the requisite code into a full-blown presentation and it works great. Now I have to go back and add it to all of my tutorial slides for teaching!

I did notice the clipboard hyperlink in your README seems to be broken.

The link destination is https://github.com/gadenbuie/xaringanExtra#-clipboard, meanwhile the anchor shows https://github.com/gadenbuie/xaringanExtra#%EF%B8%8F-clipboard

mattwarkentin commented 4 years ago

Oh, and the two examples in your Clipboard Demo for using Spanish and Font Awesome icons (https://pkg.garrickadenbuie.com/xaringanExtra/clipboard/#5) does not actually show those changes for the clipboard buttons for the relevant code blocks. Not sure if they are meant to or not.

gadenbuie commented 4 years ago

Thanks for letting me know... I fixed the link in the readme -- https://github.com/gadenbuie/xaringanExtra#-clipboard -- but I might eventually remove most of the GitHub readme and link out to https://pkg.garrickadenbuie.com/xaringanExtra

The buttons were "one per slide deck" before, but I changed my mind and decided to support multiple clip buttons per document. This makes it easier to customize in general R Markdown outputs and lets you change the text for different contexts.

So good news, the demo on https://pkg.garrickadenbuie.com/xaringanExtra/clipboard/#5 now shows up in Spanish and as icons! 🎉