Created
February 6, 2013 18:00
-
-
Save graphaelli/4724481 to your computer and use it in GitHub Desktop.
markdown previewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" .vimrc: autocmd BufEnter *.md exe 'noremap <F5> :!mdpreview.py %<CR>' """ | |
import subprocess, sys, tempfile | |
with tempfile.NamedTemporaryFile(suffix=".html", delete=False) as mdhtml: | |
subprocess.check_call(["pandoc", "--to=html", "--from=markdown", "-o", mdhtml.name, sys.argv[1]]) | |
# webbrowser.open_new_tab ... chrome howto? | |
subprocess.check_call(["open", "-a", "Google Chrome", mdhtml.name]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment