Goal: copy markdown, do something to interpret markdown, then have formatted text on the clipboard to paste
- Unix/X11:
xclip -selection clipboard -out | pandoc --standalone --from markdown --to html | xclip -selection clipboard -t text/html
- macOS:
pbpaste | textutil -stdin -format html -convert rtf -stdout | pbcopy
- Windows/Powershell:
Get-Clipboard | pandoc --standalone --from markdown --to html | Set-Clipboard -AsHtml
Since pandoc will assume from markdown to html, and --standalone
has a short flag, pandoc -s
in the middle should be equivalent (but verify for yourself).
On Unix, install pandoc and xclip. While the Unix command was only tested on Linux, it should also work on BSD since both xclip and pandoc are in Ports.