Skip to content

Instantly share code, notes, and snippets.

@mikeslattery
Last active August 1, 2020 02:12
Show Gist options
  • Save mikeslattery/6187a171201075c5be5137aa07c03108 to your computer and use it in GitHub Desktop.
Save mikeslattery/6187a171201075c5be5137aa07c03108 to your computer and use it in GitHub Desktop.
Markdown to Clipboard
#!/bin/bash
# Converts markdown format to clipboard in html format.
# Requres Wayland, pandoc, and wl-clipboard.
# Usage:
# rt-clip - Copy from stdin
# rt-clip <file> Copy from a file
# rt-clip Copy from clipbaord
if [[ "$1" == "-" ]]; then shift; cat
elif [[ -f "$1" ]]; then shift; cat "$1"
else wl-paste
fi | pandoc -f markdown -t html | wl-copy -t text/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment