Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
markdown previewer
#!/usr/bin/env python
""" .vimrc: autocmd BufEnter *.md exe 'noremap <F5> :! %<CR>' """
import subprocess, sys, tempfile
with tempfile.NamedTemporaryFile(suffix=".html", delete=False) as mdhtml:
subprocess.check_call(["pandoc", "--to=html", "--from=markdown", "-o",, sys.argv[1]])
# webbrowser.open_new_tab ... chrome howto?
subprocess.check_call(["open", "-a", "Google Chrome",])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment