Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Amber | 5f98d7658c | |
Amber | d8f265654d | |
Amber | 1f2145c9ca | |
Amber | 6d10a7ba68 |
|
@ -4,3 +4,7 @@ outdir
|
||||||
indir
|
indir
|
||||||
sample.md
|
sample.md
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
venv/
|
||||||
|
github-markdown-css/
|
||||||
|
sample.html
|
||||||
|
images/
|
||||||
|
|
2
main.py
2
main.py
|
@ -11,7 +11,7 @@ footStr = "\n</body>\n</html>"
|
||||||
|
|
||||||
def printHtml(head, body, foot, outFile):
|
def printHtml(head, body, foot, outFile):
|
||||||
file = open(outFile, 'w')
|
file = open(outFile, 'w')
|
||||||
file.write(str(head + body + foot))
|
file.write(head + body + foot)
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|
15
readFile.py
15
readFile.py
|
@ -1,26 +1,27 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import markdown
|
import markdown2
|
||||||
|
from bs4 import BeautifulSoup as bs
|
||||||
|
|
||||||
# Only do the <body> tag
|
# Only do the <body> tag
|
||||||
class readMarkdown():
|
class readMarkdown():
|
||||||
outStr = ""
|
|
||||||
mdFile = ""
|
mdFile = ""
|
||||||
|
|
||||||
def __init__(self, mdFile):
|
def __init__(self, mdFile):
|
||||||
self.outStr = ""
|
|
||||||
self.mdFile = mdFile
|
self.mdFile = mdFile
|
||||||
|
outLi = []
|
||||||
|
|
||||||
def markdown(self):
|
def markdown(self):
|
||||||
file = open(self.mdFile, 'r')
|
file = open(self.mdFile, 'r')
|
||||||
outStr = str(markdown.markdown(file.read())) #TODO: I really want nice tab indentations
|
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()
|
file.close()
|
||||||
return(outStr)
|
return(outStr)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return(str(self.markdown()))
|
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
|
# 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
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
python
|
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)
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
# TODO: don't hard-code theme, look into extensability
|
# TODO: don't hard-code theme, look into extensability
|
||||||
|
|
||||||
basic = {
|
basic = {
|
||||||
"navCss": "css/navbar.css",
|
"navCss": "css/base_navbar.css",
|
||||||
"bodyCss": "css/home.css",
|
"bodyCss": "css/base_main.css",
|
||||||
"headerCss": "",
|
"headCss": "",
|
||||||
"footCss": ""
|
"footCss": "",
|
||||||
|
"sideCss": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
class css():
|
class css():
|
||||||
|
|
Loading…
Reference in New Issue