carpentries / varnish

Template for pkgdown site
https://carpentries.github.io/varnish/
Other
7 stars 33 forks source link

Add copy-to-clipboard functionality to code blocks #159

Open fiveop opened 2 days ago

fiveop commented 2 days ago

An accompanying patch (https://github.com/carpentries/sandpaper/pull/625) for sandpaper adds buttons with class copy-button to code blocks.

The styling of the button is a suggestion.

The overall intention is to resolve https://github.com/carpentries/workbench/issues/58.

froggleston commented 2 days ago

Hi @fiveop - thank you for the contribution! I have spoken to @tobyhodges about this and we have a couple of concerns:

  1. learners would feel motivated to use the copy paste functionality in live workshops when following along and typing is a key tenet of our pedagogy
  2. instructors may feel motivated to use copy paste in live settings, when they are running short on time for example

A compromise could be that this copy paste option is only enabled when a configuration setting is provided, e.g. a "debug" or development mode for that lesson. This would allow lesson developers and maintainers to turn this on locally and use the functionality to quickly debug issues and code blocks. This would also mean that our official lessons would have this option disabled and the lessons would look as they do now.

Would this be a fair solution?

fiveop commented 1 day ago

I have not thought of that and I admit that it is very rare that I missed such a button, mostly while preparing for a course, or as you suggest, while working on the material. Regarding your arguments:

  1. I would agree with that to a certain degree. In my workshops participants usually do not have the learning material open, but there are of course people who use the material for self-study.
  2. I wold argue that we should trust Carpentries instructors not to do that.

Overall such a button offers a small convenience, replacing a selection and a shortcut with a single click. Given your arguments, I would suggest to leave the button out of the learners’ view, but show it in the instructors’ view. Though for me, that would be a compromise, as I tend towards trusting other people to act in their best interest after having instructed them how to do so.