Skip to content

Commit efc427d

Browse files
nastasi-oqCarlton Gibson
authored andcommitted
Reuse 'apply_markdown' function in 'render_markdown' templatetag func (#5469)
* reused 'apply_markdown' function in 'render_markdown' templatetag function * typo fixed
1 parent 018e43e commit efc427d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rest_framework/templatetags/rest_framework.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from django.utils.safestring import SafeData, mark_safe
1212

1313
from rest_framework.compat import (
14-
NoReverseMatch, markdown, pygments_highlight, reverse, template_render
14+
NoReverseMatch, apply_markdown, pygments_highlight, reverse,
15+
template_render
1516
)
1617
from rest_framework.renderers import HTMLFormRenderer
1718
from rest_framework.utils.urls import replace_query_param
@@ -68,9 +69,9 @@ def form_for_link(link):
6869

6970
@register.simple_tag
7071
def render_markdown(markdown_text):
71-
if not markdown:
72+
if apply_markdown is None:
7273
return markdown_text
73-
return mark_safe(markdown.markdown(markdown_text))
74+
return mark_safe(apply_markdown(markdown_text))
7475

7576

7677
@register.simple_tag

0 commit comments

Comments
 (0)