mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 22:23:23 +00:00
21 lines
503 B
Python
21 lines
503 B
Python
from rest_framework.response import Response
|
|
from rest_framework.decorators import api_view, renderer_classes
|
|
from rest_framework.renderers import StaticHTMLRenderer
|
|
from rest_framework.views import APIView
|
|
|
|
from core.templatetags.renderer import markdown
|
|
|
|
|
|
@api_view(['GET'])
|
|
@renderer_classes((StaticHTMLRenderer,))
|
|
def RenderMarkdown(request):
|
|
"""
|
|
Render Markdown
|
|
"""
|
|
try:
|
|
data = markdown(request.GET['text'])
|
|
except:
|
|
data = 'Error'
|
|
return Response(data)
|
|
|