]>
Commit | Line | Data |
---|---|---|
4765f35e DL |
1 | #!/usr/bin/env python |
2 | # written 2016 by David Lamparter, placed in Public Domain. | |
3 | import sys, markdown | |
4 | ||
5 | template = '''<html><head><meta charset="UTF-8"><style type="text/css"> | |
6 | body { max-width: 45em; margin: auto; margin-top: 2em; margin-bottom: 2em; | |
7 | font-family:Fira Sans,sans-serif; text-align: justify; } | |
8 | pre, code { font-family:Fira Mono,monospace; } | |
9 | pre > code { display: block; padding:0.5em; border:1px solid black; | |
10 | background-color:#eee; color:#000; } | |
9b7939d9 DL |
11 | h2 { clear: both; margin-top: 3em; text-decoration: underline; } |
12 | h3 { clear: both; margin-top: 2em; font-weight: normal; font-style: italic; } | |
4765f35e | 13 | h4 { font-weight: normal; font-style: italic; } |
9b7939d9 | 14 | img[alt~="float-right"] { float:right; margin-left:2em; margin-bottom:2em; } |
4765f35e DL |
15 | </style></head><body> |
16 | %s | |
17 | </body></html> | |
18 | ''' | |
19 | ||
20 | md = markdown.Markdown(extensions=['extra', 'toc']) | |
21 | ||
22 | for fn in sys.argv[1:]: | |
23 | with open(fn, 'r') as ifd: | |
24 | with open('%s.html' % (fn), 'w') as ofd: | |
25 | ofd.write((template % (md.convert(ifd.read().decode('UTF-8')))).encode('UTF-8')) |