I needed a way to import interesting stuff from a web page into my DokuWiki . This is where I collect phone numbers, contacts, to-dos, bank accounts, links, pictures, quotes... well, everything and then some. The backbone of my life.

I solved this by translating from HTML to DokuWiki markup using xclip and pandoc. This is for Linux and the Firefox browser which has the "view selection source" option.

xclip is an interface to the X11 clipboard, pandoc is a universal markup converter - created by philosophy professor John MacFarlane. Pandoc can also convert to MediaWiki, TikiWiki, TWiki, Vimwiki, XWiki and ZimWiki.

Pandoc uses an internal translation format that produces perfect conversions with headings, quotes, images and links.

xclip and pandoc can use stdin / stdout 'piping'. Converting the clipboard becomes ridiculously easy. A script with Zenity dialogs looks like this:

To install on Linux; save clip-to-dokuwiki.sh somewhere in your $PATH e.g. /home/[user]/.local/bin and make it executable with chmod u+x clip-to-dokuwiki.sh

Link the script to a keyboard shortcut, why not Super-M for M-arkup? On OpenBox go to Keyboard settings -> Application Shortcuts tab -> Add and enter the path /home/[user]/.local/bin/clip-to-dokuwiki.sh and link to a keyboard shortcut - I use super-M.

  1. Select the text you want to lift into DokuWiki on a web page.
  2. Right-click and choose "View Selection Source". Your selection will now open as HTML in a new tab. Ctrl-C to copy the HTML, and then...
  3. super-M to run the script and convert the contents of the clipboard to DokuWiki markup.
  4. Last step: create a blank wiki page and ctrl-V paste the converted text.

Only Firefox has 'view selection source' on right-click, why Chromium doesn't have this very useful feature is a mystery.


  • Select text in Firefox browser
  • Right-click on the selection and 'view selection source'
  • Ctrl-C, copy the source HTML
  • Super-M, or any other keyboard combination you choose, to run the script
  • Create empty DokuWiki Page
  • Ctrl-V to paste the markup on the page

Cover image by /u/KaanahBeoulve