"""Implementation of compile_html based on markdown.""" __all__ = ['compile_html'] import codecs import re from markdown import markdown def compile_html(source, dest): try: os.makedirs(os.path.dirname(dest)) except: pass with codecs.open(dest, "w+", "utf8") as out_file: with codecs.open(source, "r", "utf8") as in_file: data = in_file.read() output = markdown(data, ['fenced_code', 'codehilite']) # remove the H1 because there is "title" h1. output = re.sub(r'