summaryrefslogtreecommitdiff
path: root/converters/html_to_md.py
blob: b6aeae0cca6dfcbfc5944d2741b13201c0f48155 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
from os import walk
import os.path
from markdownify import markdownify

def convert_html_to_md(HtmlList):
    for path in HtmlList:

        pathsplit = path.split("/")

        file = open(str(path), "r").read()
        html = markdownify(file, heading_style="ATX")
        f = open("output/markdown/" + str(pathsplit[-1]).replace(".html", ".md"), "w")
        f.write(html)
        f.close()



    return "html was converted to markdown (1/3)"