diff --git a/requirements.txt b/requirements.txt index f449bbb..af917cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ djangorestframework==3.3.2 coverage==4.0.3 flake8==2.5.1 mkdocs==0.15.3 +django-markwhat==1.5 \ No newline at end of file diff --git a/rest_framework_docs/templates/rest_framework_docs/home.html b/rest_framework_docs/templates/rest_framework_docs/home.html index 235a6ee..56a0905 100644 --- a/rest_framework_docs/templates/rest_framework_docs/home.html +++ b/rest_framework_docs/templates/rest_framework_docs/home.html @@ -1,5 +1,7 @@ {% extends "rest_framework_docs/docs.html" %} +{% load markup %} + {% block apps_menu %} {% regroup endpoints by name_parent as endpoints_grouped %}
{{ endpoint.docstring }}
+{{ endpoint.docstring|rst }}
{% endif %} {% if endpoint.errors %} diff --git a/rest_framework_docs/templatetags/__init__.py b/rest_framework_docs/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rest_framework_docs/templatetags/markup.py b/rest_framework_docs/templatetags/markup.py new file mode 100644 index 0000000..e7bceff --- /dev/null +++ b/rest_framework_docs/templatetags/markup.py @@ -0,0 +1,14 @@ +""" +Defining a custom template tag as a wrapper around the restructuredtext template tag provided by the +django-markwhat library. This prevents the need for users to also install django-markwhat into their +INSTALLED_APPS. +""" +from django import template +from django_markwhat.templatetags.markup import restructuredtext + +register = template.Library() + + +@register.filter(is_safe=True) +def rst(value): + return restructuredtext(value)