Skip to content

Commit bf320e4

Browse files
committed
fixed: #49
1 parent 9884bff commit bf320e4

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

martor/utils.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
)
1111

1212

13+
class VersionNotCompatible(Exception):
14+
pass
15+
16+
1317
def markdownify(markdown_content):
1418
"""
1519
Render the markdown content to HTML.
@@ -21,12 +25,16 @@ def markdownify(markdown_content):
2125
'<p><img alt="awesome" src="http://i.imgur.com/hvguiSn.jpg" /></p>'
2226
>>>
2327
"""
24-
return markdown.markdown(
25-
markdown_content,
26-
safe_mode=MARTOR_MARKDOWN_SAFE_MODE,
27-
extensions=MARTOR_MARKDOWN_EXTENSIONS,
28-
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
29-
)
28+
try:
29+
return markdown.markdown(
30+
markdown_content,
31+
safe_mode=MARTOR_MARKDOWN_SAFE_MODE,
32+
extensions=MARTOR_MARKDOWN_EXTENSIONS,
33+
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
34+
)
35+
except Exception:
36+
raise VersionNotCompatible("The markdown isn't compatible, please reinstall "
37+
"your python markdown into Markdown==2.6.9")
3038

3139

3240
class LazyEncoder(DjangoJSONEncoder):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Django
2-
Markdown<3.0
2+
Markdown
33
requests

0 commit comments

Comments
 (0)