To use this script, I copy a URL to the iOS clipboard and jump into Pythonista. I trigger this script to get the web page in Markdown encoded text.
is turned into plain text and put back on the clipboard. The results are displayed in a popup Pythonista browser window:
Here's the script:
import clipboard import urllib2 import webbrowser clipString = clipboard.get() marky = 'http://heckyesmarkdown.com/go/?u=' queryString = marky + clipString reqMD = urllib2.Request(queryString) openMD = urllib2.urlopen(reqMD) content = (openMD.read().decode('utf-8')) clipboard.set(content) webbrowser.open(queryString)
The script started life with a mess of URL validations steps, but Brett's service is so awesome that it just fails gracefully with bad URL's. But I did try out the new Pythonista console.alert() method. I like it.