I'm loving that I can use Editorial (iOS) to compose an email in Markdown and pipe a rendered HTML message straight to Mail.app. I'd love to do this with Sublime Text 3 and Sparrow (or any default mail client) on the Mac, and I'm wondering whether it will be possible (or sensible) for me to make a Sublime package or build script.
The only problem is that I don't know Python. I'm not looking for the final solution, just whether my plan of using Python is a reasonable one given that I'd like to actually get this working.
That's a pretty cool idea actually.
Step 1: Get a markdown syntax definition, like: sublime-markdown-extended
Step 2: Go to "Tools -> Build System -> New Build System" and add your new build:
{
"cmd": ["python", "-u", "/path/to/convert.py $file"],
"selector": "source.markdown",
"path": "/usr/local/lib/python"
}
Step 3: convert.py uses markdown2 to create html and opens Mail.app for you:
import sys
import markdown2
with open(sys.argv[0]) as f:
script = 'tell application "Mail"' \
'make new outgoing message with properties {' \
'visible:true,content:"%s" }' \
'end tell' % markdown2.markdown(f.read())
p = Popen('/usr/bin/osascript',stdin=PIPE,stdout=PIPE)
p.communicate(script)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With