html.xonsh/readFile.py

28 lines
633 B
Python
Executable File

#!/usr/bin/python
import markdown
# Only do the <body> tag
class readMarkdown():
outStr = ""
mdFile = ""
def __init__(self, mdFile):
self.outStr = ""
self.mdFile = mdFile
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)
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