Skip to content

Instantly share code, notes, and snippets.

@nathanalderson
Created May 5, 2018 04:00
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 nathanalderson/8f069b0780f0fddc302119315d994a71 to your computer and use it in GitHub Desktop.
Save nathanalderson/8f069b0780f0fddc302119315d994a71 to your computer and use it in GitHub Desktop.
Tansform clipboard contents from markdown to HTML
#!/usr/bin/env bash
xclip -selection clipboard -o | pandoc --from markdown --to html | xclip -selection clipboard -target text/html
@nathanalderson
Copy link
Author

Put this in an executable file somewhere on your path and set a keyboard shortcut to call it. Then you can copy some markdown, hit your key combo, and paste the text into many applications as richly formatted text. Useful, for example, to compose text in markdown in your favorite text editor and then paste it as formatted text into an email client or word processor.

Depends on xclip and pandoc, both readily available on most Linux distros via the standard repositories.

@nathanalderson
Copy link
Author

Especially useful in combination with something like vim-anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment