File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1010)
1111
1212
13+ class VersionNotCompatible (Exception ):
14+ pass
15+
16+
1317def 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
3240class LazyEncoder (DjangoJSONEncoder ):
Original file line number Diff line number Diff line change 11Django
2- Markdown < 3.0
2+ Markdown
33requests
You can’t perform that action at this time.
0 commit comments