mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 13:14:30 +03:00
Reuse 'apply_markdown' function in 'render_markdown' templatetag func (#5469)
* reused 'apply_markdown' function in 'render_markdown' templatetag function * typo fixed
This commit is contained in:
parent
018e43e908
commit
efc427dfc8
|
@ -11,7 +11,8 @@ from django.utils.html import escape, format_html, smart_urlquote
|
||||||
from django.utils.safestring import SafeData, mark_safe
|
from django.utils.safestring import SafeData, mark_safe
|
||||||
|
|
||||||
from rest_framework.compat import (
|
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.renderers import HTMLFormRenderer
|
||||||
from rest_framework.utils.urls import replace_query_param
|
from rest_framework.utils.urls import replace_query_param
|
||||||
|
@ -68,9 +69,9 @@ def form_for_link(link):
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def render_markdown(markdown_text):
|
def render_markdown(markdown_text):
|
||||||
if not markdown:
|
if apply_markdown is None:
|
||||||
return markdown_text
|
return markdown_text
|
||||||
return mark_safe(markdown.markdown(markdown_text))
|
return mark_safe(apply_markdown(markdown_text))
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
|
|
Loading…
Reference in New Issue
Block a user