From 5f98d7658c20e08a09313a0c58968a1bbb96e83d Mon Sep 17 00:00:00 2001 From: Amber Date: Wed, 9 Mar 2022 13:23:40 -0600 Subject: [PATCH] i've spent hours working and accomplished literally nothing useful --- main.py | 2 +- readFile.py | 20 ++++++++++---------- requirements | 4 +++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 939f412..c04bd51 100755 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ footStr = "\n\n" def printHtml(head, body, foot, outFile): file = open(outFile, 'w') - file.write(str(head + body + foot)) + file.write(head + body + foot) file.close() diff --git a/readFile.py b/readFile.py index 3bff830..0ce826b 100755 --- a/readFile.py +++ b/readFile.py @@ -1,27 +1,27 @@ #!/usr/bin/python -import markdown +import markdown2 +from bs4 import BeautifulSoup as bs # Only do the tag class readMarkdown(): - outStr = "" mdFile = "" def __init__(self, mdFile): - self.outStr = "" self.mdFile = mdFile - + outLi = [] def markdown(self): file = open(self.mdFile, 'r') - self.outStr = markdown.markdown(file.read(), tab_length=4, output_format="html") - file.close() - return(self.outStr) + outStr = "" - + #outStr = bs(markdown.markdown(str(outLi[1]), tab_length=4, output_format="html", extensions=['codehilite', 'tables'])) + outStr = markdown2.markdown(str(file.read()), extras=['fenced-code-blocks', 'metadata']) + + file.close() + return(outStr) def __str__(self): return(str(self.markdown())) -# might want to find a way to diff html from a file and readMarkdown()'s output if I want to update pages -# Edit: just keep the original markdown files dumbass +# might want to find a way to diff html from a file and readMarkdown()'s output if I want to update pages \ No newline at end of file diff --git a/requirements b/requirements index 350e0a0..8f31015 100644 --- a/requirements +++ b/requirements @@ -1,2 +1,4 @@ python -python-markdown https://python-markdown.github.io/ +#python-markdown https://python-markdown.github.io/ +beautifulsoup4 +gh-md-to-html (for now, will replace later)