processing / processing-pi-website

Files for the pi.processing.org subdomain that documents Processing on the Raspberry Pi
https://pi.processing.org/
16 stars 10 forks source link

Make it easier to copy / download source code #17

Open msurguy opened 6 years ago

msurguy commented 6 years ago

Currently, there is no easy way to download the sketch files presented in tutorials.

Perhaps we can explore enabling "copy to clipboard" functionality or a way to download PDE files.

There's also an option of streamlining the process of embedding the Processing sketches in the tutorials by using Hugo's file reader functions and basically creating separate .pde files for each sketch that could be downloaded.

@gohai let me know what you think about this

gohai commented 6 years ago

Interesting idea. I am guessing that there could be situations where it's also necessary to distribute data files in tandem with the sketches themselves - for this the "copy to clipboard" would not help, but a "download sketch (including data)" would..

msurguy commented 6 years ago

I've found a few Hugo themes that implement this well. The Hugo-Learn theme has a nice shortcode and demo for attachments: https://learn.netlify.com/en/shortcodes/attachments/

And a way to use copy to clipboard function:

See example at - https://learn.netlify.com/en/cont/pages/ https://github.com/matcornic/hugo-theme-learn/blob/bb0d317af27df1a030727ca03a177edef3ef0e43/static/js/learn.js#L176 https://github.com/matcornic/hugo-theme-learn/blob/dea425fc7563c589d700605f3226e43b522b952b/static/js/hugo-learn.js#L66 https://github.com/matcornic/hugo-theme-learn/blob/6562adeb7b3ead1e199272b450a61ad07faf48f4/static/css/theme.css#L1051