import markdown import bleach import sys if len(sys.argv) != 3: print("usage: python script.py ") sys.exit(1) input_markdown_file = sys.argv[1] output_html_file = sys.argv[2] with open(input_markdown_file, 'r') as f: text = f.read() # converts the markdown to html html = markdown.markdown(text) # makes links that begin with https:// clickable html_with_links = bleach.linkify(html) # defines a template that should be at the beginning of the html start_template = ''' readme ''' # defines a template that should be at the end end_template = ''' ''' # combines them final_html = start_template + html_with_links + end_template with open(output_html_file, 'w') as f: f.write(final_html)