Skip to content

Instantly share code, notes, and snippets.

@mheland
Last active April 13, 2019 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mheland/ef0aab5de2ec87d8a9791a50827775f7 to your computer and use it in GitHub Desktop.
Save mheland/ef0aab5de2ec87d8a9791a50827775f7 to your computer and use it in GitHub Desktop.
Translate HTML in clipboard to DokuWiki markup
#!/bin/bash
# Pipe clipboard to pandoc and pipe the DokuWiki markup back to clipboard
xclip -o -selection clipboard | pandoc -f html -t dokuwiki | xclip -selection clipboard
# Display first five non-blank lines from clipboard cut to one hundred characters in the confirmation dialog
result=$(xclip -o -selection clipboard | tr -s '\n' '\n' | head -n 5 | cut -c -100 )
# Info box with preview of clipboard contents
zenity --info --title="HTML to Dokuwiki markup" --text="Clipboard preview: \n\n $result" --width=300 --height=100
# Optional if you don't use Zenity...
# notify-send "Translated to DokuWiki markup in clipboard"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment