-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_docs.py
More file actions
34 lines (29 loc) · 991 Bytes
/
build_docs.py
File metadata and controls
34 lines (29 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import markdown
EXTENSIONS = ['markdown.extensions.toc',
'markdown.extensions.smarty',
'markdown.extensions.fenced_code',
'markdown.extensions.nl2br',
'markdown.extensions.headerid',
'markdown.extensions.codehilite']
md = markdown.Markdown(extensions=EXTENSIONS,
extension_configs={
'markdown.extensions.codehilite': {
'noclasses': True
}
})
BASE = './'
def build_doc(file_name):
if file_name.endswith('.md'):
print(file_name)
title = file_name[:-3]
new_file_name = title+'.html'
full_path = os.path.join(BASE, file_name)
out_path = os.path.join(BASE, new_file_name)
md.convertFile(full_path, out_path)
print(title)
if __name__ == "__main__":
from sys import argv
print(argv)
for file_name in argv:
build_doc(file_name)