Call reset() if already initialized.

This also include a workaround for a
waiting-to-be-merged bug in python-markdown.
This commit is contained in:
Glandos
2018-06-19 22:43:07 +02:00
parent cb2a0898e5
commit c3fc14c4f1

View File

@@ -81,6 +81,12 @@ def read_markdown(filename):
MD = Markdown(extensions=['markdown.extensions.meta',
'markdown.extensions.tables'],
output_format='html5')
else:
MD.reset()
# When https://github.com/Python-Markdown/markdown/pull/672
# will be available, this can be removed.
MD.Meta = {}
# Mark HTML with Markup to prevent jinja2 autoescaping
output = {'description': Markup(MD.convert(text))}