Skip to content

Instantly share code, notes, and snippets.

@viticci
Created November 19, 2015 13:00
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save viticci/5818d12b6dccec536eff to your computer and use it in GitHub Desktop.
Selection.py
# coding: utf-8
import sys
import html2text
import clipboard
import webbrowser
webpage = clipboard.get()
text = sys.argv[1]
h = html2text.HTML2Text()
h.body_width = 0
converted = h.handle(text)
clipboard.set('> ' + converted)
webbrowser.open('safari-' + webpage)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment