Skip to content

Instantly share code, notes, and snippets.

@viticci
Created November 24, 2015 03:15
Show Gist options
  • Save viticci/3b332dfb00a1ca67f230 to your computer and use it in GitHub Desktop.
Save viticci/3b332dfb00a1ca67f230 to your computer and use it in GitHub Desktop.

Revisions

  1. viticci created this gist Nov 24, 2015.
    18 changes: 18 additions & 0 deletions Selection.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # 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)