alabaster icon indicating copy to clipboard operation
alabaster copied to clipboard

clipboard.js integration

Open tarekziade opened this issue 8 years ago • 4 comments

Would you be interested in a clipboard.js integration?

A small "copy to clipboard" button on code blocks (literalinclude and code-block directives)

the hackish way is to inject the .js in the theme and plug it on the block css

the clean way is probably to create a new directive based on https://github.com/sphinx-doc/sphinx/blob/master/sphinx/directives/code.py#L373 and https://github.com/sphinx-doc/sphinx/blob/master/sphinx/directives/code.py#L97 , so we can control which block gets a button, but then it's not backward compatible

tarekziade avatar Sep 05 '17 13:09 tarekziade

I personally think this would be great! Would be interested in hearing others thoughts, though.

kennethreitz avatar Sep 05 '17 13:09 kennethreitz

https://clipboardjs.com/

tarekziade avatar Sep 05 '17 19:09 tarekziade

I think this would be neat but it'd be predicated on the usual concerns - e.g. not disruptive or frustrating for users who don't want it, and easy to configure.

bitprophet avatar Sep 05 '17 19:09 bitprophet

I assume default would be off, and it'd be an html_option boolean.

kennethreitz avatar Sep 05 '17 21:09 kennethreitz