Last active
September 27, 2015 07:50
-
-
Save aliva/50af55a5e887ba0e227d to your computer and use it in GitHub Desktop.
This file contains hidden or 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/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