Created
November 28, 2014 04:32
-
-
Save ryumei/3a752622cf948533008e to your computer and use it in GitHub Desktop.
Convert Markdown to HTML by Python
This file contains 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 | |
# -*- 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