From bbedc5c896800de4b23b5042e10b61a0e85222db Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sun, 1 Oct 2017 11:20:23 +0200 Subject: [PATCH] reused 'apply_markdown' function in 'render_markdown' templatetag function --- rest_framework/templatetags/rest_framework.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index a2ee5ccdd..e401b9ff3 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -11,7 +11,8 @@ from django.utils.html import escape, format_html, smart_urlquote from django.utils.safestring import SafeData, mark_safe from rest_framework.compat import ( - NoReverseMatch, markdown, pygments_highlight, reverse, template_render + NoReverseMatch, apply_markdown, pygments_highlight, reverse, + template_render, ) from rest_framework.renderers import HTMLFormRenderer from rest_framework.utils.urls import replace_query_param @@ -68,9 +69,9 @@ def form_for_link(link): @register.simple_tag def render_markdown(markdown_text): - if not markdown: + if apply_markdown is None: return markdown_text - return mark_safe(markdown.markdown(markdown_text)) + return mark_safe(apply_markdown(markdown_text)) @register.simple_tag