Make Markdown 2.6 the minimum compatible version (#6576)

This commit is contained in:
Tim Gates 2019-05-09 12:34:38 +10:00 committed by Ryan P Kilby
parent 2e7ab9d6c6
commit 564faddb0f
2 changed files with 4 additions and 11 deletions

View File

@ -93,7 +93,7 @@ each Python and Django series.
The following packages are optional: The following packages are optional:
* [coreapi][coreapi] (1.32.0+) - Schema generation support. * [coreapi][coreapi] (1.32.0+) - Schema generation support.
* [Markdown][markdown] (2.1.0+) - Markdown support for the browsable API. * [Markdown][markdown] (2.6.0+) - Markdown support for the browsable API.
* [django-filter][django-filter] (1.0.1+) - Filtering support. * [django-filter][django-filter] (1.0.1+) - Filtering support.
* [django-crispy-forms][django-crispy-forms] - Improved HTML display for filtering. * [django-crispy-forms][django-crispy-forms] - Improved HTML display for filtering.
* [django-guardian][django-guardian] (1.1.1+) - Object level permissions support. * [django-guardian][django-guardian] (1.1.1+) - Object level permissions support.

View File

@ -143,19 +143,12 @@ if 'patch' not in View.http_method_names:
View.http_method_names = View.http_method_names + ['patch'] View.http_method_names = View.http_method_names + ['patch']
# Markdown is optional # Markdown is optional (version 2.6+ required)
try: try:
import markdown import markdown
if markdown.version <= '2.2': HEADERID_EXT_PATH = 'markdown.extensions.toc'
HEADERID_EXT_PATH = 'headerid' LEVEL_PARAM = 'baselevel'
LEVEL_PARAM = 'level'
elif markdown.version < '2.6':
HEADERID_EXT_PATH = 'markdown.extensions.headerid'
LEVEL_PARAM = 'level'
else:
HEADERID_EXT_PATH = 'markdown.extensions.toc'
LEVEL_PARAM = 'baselevel'
def apply_markdown(text): def apply_markdown(text):
""" """