Skip to content

Instantly share code, notes, and snippets.

@sbusso
Forked from viticci/Selection.py
Created June 3, 2018 01:24
Show Gist options
  • Save sbusso/74cf2d945e0ca67f4ed9f59c96eeb730 to your computer and use it in GitHub Desktop.
Save sbusso/74cf2d945e0ca67f4ed9f59c96eeb730 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