It's better when it's simple

User Tools

Site Tools


Copycode Plugin

Compatible with DokuWiki

  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes
  • 2018-04-22 "Greebo" unknown
  • 2017-02-19 "Frusterick Manners" unknown

plugin Copy code block to clipboard with just a click

Last updated on


:!: External requirements: This plugin requires jQuery (bundled with latests versions of DokuWiki).

Install the plugin using the Plugin Manager or from the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.


Adds a javascript click event on all code blocks that copy the content of the block to clipboard. Just click on a code block: done! You can also select a part of a code inside a code block, and the selection gets immediatly copied to clipboard. With right click you can copy the code block without carriage returns.


Uses navigator.clipboard function. List of compatible browsers on this page :

Change Log

  • 2022-09-12
    • Fix : commented an alert on unused mouse key clic (like previous or next buttons)
  • 2022-03-02
    • Adds functionnality to remove extra non ascii character bug
    • Adds functionnality and code logic for new mouse actions
    • Adds inline copy on right click
    • Removing default contextmenu on right click on a code block
    • Better writing of jquery elements (using $ instead of repetitive jQuery function calls)
  • 2021-08-09
    • Merged Pull Request from FootStark “Add inline code-copying with option”
  • 2021-04-21
    • Added “code” html selector in jquery
  • 2021-02-18
    • If for any reason, navigator.clipboard fails, it uses the hidden textarea hack instead
    • Added dutch language file
  • 2020-09-21
    • Added code selection copy, with its own alert box
    • css and js cleaning
  • 2020-09-08
  • 2020-08-30
  • 2020-07-01
    • Fix multi linebreaks when there is more than one code block
  • 2020-06-25
    • Fix preventing jump to top while clicking the code block
  • 2020-06-24
    • Fix of numbered lines issue
    • Updated date and link to github repository
  • 2020-06-15
    • Initial release

ToDo/Wish List

Only translated into English, French, German and Dutch. Some translations are generated with Deepl and should be corrected. More languages should be added too, don't hesitate to help !

plugin/copycode.txt · Last modified: 2022-09-12 10:49 by youplaboum

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki