askiiart-net/md2html.py
2023-03-23 22:03:13 -05:00

12 lines
409 B
Python
Executable file

import os
from glob import glob
os.chdir('/big-stuff/files/websites/personal-site/html')
md_files = glob('*.md')
md_files_no_ext = []
for item in md_files:
md_files_no_ext.append(item[:-3])
for item in md_files_no_ext:
os.system(f'pandoc -f markdown-smart --data-dir . --template template.html -t html -o {item}.html {item}.md --metadata title=\"$(grep -m 1 -oP \'(?<=^# ).*\' {item}.md | cat)\"')