2016-08-04 22:50:48 +00:00
|
|
|
from rest_framework.response import Response
|
2016-09-06 16:43:39 +00:00
|
|
|
from rest_framework.decorators import api_view, renderer_classes
|
|
|
|
from rest_framework.renderers import StaticHTMLRenderer
|
|
|
|
from rest_framework.views import APIView
|
2016-08-04 22:50:48 +00:00
|
|
|
|
|
|
|
from core.templatetags.renderer import markdown
|
2016-08-07 22:33:02 +00:00
|
|
|
|
2016-08-04 22:50:48 +00:00
|
|
|
|
|
|
|
@api_view(['GET'])
|
2016-09-06 16:43:39 +00:00
|
|
|
@renderer_classes((StaticHTMLRenderer,))
|
2016-08-04 22:50:48 +00:00
|
|
|
def RenderMarkdown(request):
|
|
|
|
"""
|
|
|
|
Render Markdown
|
|
|
|
"""
|
2016-09-06 16:43:39 +00:00
|
|
|
try:
|
|
|
|
data = markdown(request.GET['text'])
|
|
|
|
except:
|
|
|
|
data = 'Error'
|
|
|
|
return Response(data)
|
2016-08-05 18:01:23 +00:00
|
|
|
|