From ebfeb5d51e5e31195053b8ed714762ae6b0d2060 Mon Sep 17 00:00:00 2001 From: Aarontheissueguy Date: Sat, 20 Feb 2021 20:03:09 +0100 Subject: Initial commit --- converters/html_to_md.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 converters/html_to_md.py (limited to 'converters/html_to_md.py') diff --git a/converters/html_to_md.py b/converters/html_to_md.py new file mode 100644 index 0000000..b6aeae0 --- /dev/null +++ b/converters/html_to_md.py @@ -0,0 +1,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)" -- cgit v1.2.3