dnmgmt/bin/markdown-to-html

20 lines
508 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import markdown
from markdown.extensions.toc import TocExtension
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
files = [
("templates/help/faq.md", "templates/help/faq.html"),
]
for srcFile, dstFile in files:
srcFile = os.path.join(BASE_DIR, srcFile)
dstFile = os.path.join(BASE_DIR, dstFile)
markdown.markdownFromFile(open(srcFile, "rb"), open(dstFile, "wb"), extensions=[TocExtension(baselevel=1, permalink=True)])