Skip to content

Instantly share code, notes, and snippets.

@aliva
Last active September 27, 2015 07:50
Show Gist options
  • Save aliva/50af55a5e887ba0e227d to your computer and use it in GitHub Desktop.
Save aliva/50af55a5e887ba0e227d to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# pip3 install markdown
template = """<!DOCTYPE html>
<html dir="rtl">
<head>
<meta charset="utf-8">
</head>
<body>
%s
</body>
</html>
"""
import os
import markdown
files = os.listdir(".")
files = [file for file in files if file.endswith(".md")]
files.sort(reverse=True)
contents = [open(file, "r").read() for file in files]
contents = "\n\n".join(contents)
contents = markdown.markdown(contents)
contents = template % contents
open("all.html", "w").write(contents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment