Skip to content

Instantly share code, notes, and snippets.

@tippenein
Created June 21, 2013 20:31
Show Gist options
  • Save tippenein/5834109 to your computer and use it in GitHub Desktop.
Save tippenein/5834109 to your computer and use it in GitHub Desktop.
md to html
#!/usr/bin/env python
import markdown
import sys
import codecs
if __name__ == '__main__':
in_file = codecs.open(sys.argv[1], mode="r", encoding="utf-8")
text = input_file.read()
html = markdown.markdown(text)
outname = sys.argv[1] + ".html"
out_file = codecs.open(outname, "w", encoding="utf-8", errors="xmlcharrefreplace")
out_file.write(html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment