Skip to content

Instantly share code, notes, and snippets.

@ryumei
Created November 28, 2014 04:32
Show Gist options
  • Save ryumei/3a752622cf948533008e to your computer and use it in GitHub Desktop.
Save ryumei/3a752622cf948533008e to your computer and use it in GitHub Desktop.
Convert Markdown to HTML by Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# [require] Markdown module
# [usage] $ ./md2html.py markdown_file.md
#
import sys, os, re
from markdown import Markdown
md = Markdown()
for in_file in sys.argv:
out_file = re.sub('\.(markdown|md)$', '', os.path.basename(in_file)) + '.html'
md.convertFile(input=in_file, output=out_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment