Table of Contents
Compatible with DokuWiki
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
- 2018-04-22 "Greebo" yes
- 2017-02-19 "Frusterick Manners" yes
Similar to clipboardutils, codeclipboard, copycode
- Install the plugin
- Enjoy !
Once installed, it will automatically add a «copy to clipboard»
button to every
<file> code block
as shown on the screenshot below. Actually, on desktop browser, buttons become visible
only when mouse cursor enters the
<file> region. On mobile
browsers, the buttons are always visible.
This extension add a clipboard button to
<file> blocks that copies text to the clipboard
This is already done by other extensions, copycode and codeclipboard. However, it has the following advantages over the other extensions (beeing horribly partial here ) :
- It uses a relatively new but stable javacript API, so it should work for years before it becomes incompatible with navigators,
- Thus, as far as I can see, there will be no need to update this extension in the next millenia,
- It correctly copies codes formatted by geshi1). if you encounter the dreaded “Unrecognized character \xC2” error when you copy code to perl or python, manually or with other extensions, then copy2clipboard is the extension you need,
It has no known bugs, yet.2)
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Configuration and Settings
There is nothing to configure. If you want that this plugin uses your language, please add a translation on https://translate.dokuwiki.org/plugin/copy2clipboard .
- version up (2022-05-16 20:51)
- don't let the cp2clip div cover a nearby edit button (2022-05-16 20:50)
- version up (2022-03-18 10:06)
- Merge pull request #5 from dokuwiki-translate/lang_update_419_1647169167 (2022-03-18 10:05)
- Merge pull request #4 from dokuwiki-translate/lang_update_418_1647169129 (2022-03-18 10:04)
- Merge pull request #7 from schplurtz/valign. Fix #6 (2022-03-18 09:56)
- valign the whole container div as is the original <pre> (2022-03-18 09:51)
- nicify code (2022-03-15 14:21)
Known Bugs and Issues
- lone NO-BREAK SPACEs, (aka NBSP, aka U+00A0) on a line by themselves are not copied to the clipboard.
- This is not a bug but a feature. A lone NBSP almost never happens intentionally in a source code, so this will virtually break no code. On the other hand, geshi which is used by DokuWiki adds it to every empty lines, making empty lines non empty. Moreover, U+00A0 is not a white space, and it causes syntax error in programming languages, or formatted text file such as YAML or LDIF. The benefit of removing this character is much greater than the drawback of keeping it.
Issues, bug, suggestions should only be discussed on github issues page.
Please note that issues relating to browser compatibility will not be fixed (by the author).
Please, use github issue page so this page stays as clear and simple as possible.