Skip to content

GitHub copy code snippet

Rob Garrison edited this page Oct 24, 2022 · 17 revisions

A userscript adds a copy to clipboard button on hover of markdown code snippets

  • A button is added each pre formatted code block in markdown pages.
  • Clicking the button will copy the contents of the code block to the clipboard.
  • Buttons are not added to subdomains of GitHub, e.g. help.github.com, because the clipboard script is not loaded on those pages by default.
  • Click this link to install from GitHub; or, install from GreasyFork or OpenUserJS.

Screenshot

Change Log

Version 0.3.10 (2022-10-24)

  • Update dependencies

Version 0.3.9 (2022-02-24)

  • Copy code snippet now only enabled for Gists.

Version 0.3.8 (2021-07-21)

  • Update mutation script.

Version 0.3.7 (2021-01-31)

  • Update mutation script.

Version 0.3.6 (2020-07-23)

Version 0.3.5 (2019-02-16)

  • Update GitHub icon.

Version 0.3.4 (2019-01-28)

  • Update mutation script.

Version 0.3.3 (2018-10-05)

  • Update mutation script.

Version 0.3.2 (2018-05-17)

  • Update mutation script.

Version 0.3.1 (2018-05-10)

  • Update mutation script.

Version 0.3.0 (2018-05-01)

  • Use new clipboard-copy element.
  • Target all code in comments.

Version 0.2.3 (2018-04-09)

  • Update mutation script url.

Version 0.2.2 (2018-04-02)

Version 0.2.1 (2018-01-28)

Version 0.2.0 (2018-01-24)

  • Code blocks are no longer wrapped. Fixes issue #35.

Version 0.1.0 (2018-01-12)

  • Initial commit
Clone this wiki locally