Apply markdown
This commit is contained in:
parent
fa1bf6f884
commit
1231cfc9db
2 changed files with 6 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ from io import BytesIO
|
||||||
|
|
||||||
import magic
|
import magic
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
import markdown
|
||||||
|
|
||||||
from distribusi.page_template import html_footer, html_head
|
from distribusi.page_template import html_footer, html_head
|
||||||
from distribusi.mappings import CODE_TYPES, FILE_TYPES, SUB_TYPES
|
from distribusi.mappings import CODE_TYPES, FILE_TYPES, SUB_TYPES
|
||||||
|
|
@ -156,6 +157,9 @@ def distribusify(args, directory): # noqa
|
||||||
# if the plain text is code,
|
# if the plain text is code,
|
||||||
# which types do we wrap in pre-tags?
|
# which types do we wrap in pre-tags?
|
||||||
a = "<pre>" + open(full_path).read() + "</pre>"
|
a = "<pre>" + open(full_path).read() + "</pre>"
|
||||||
|
elif subtype == 'markdown' or name.endswith('.md'):
|
||||||
|
a = "<pre>" + markdown.markdown(open(full_path).read()) + "</pre>"
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
subtype = subtype+' unkown-file'
|
subtype = subtype+' unkown-file'
|
||||||
a = "<a href='{}'>{}</a>"
|
a = "<a href='{}'>{}</a>"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
pillow
|
pillow
|
||||||
python-magic
|
python-magic
|
||||||
python-magic-bin
|
python-magic-bin
|
||||||
|
markdown
|
||||||
Loading…
Reference in a new issue