mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
Markdown 2.1 compatible
This commit is contained in:
parent
b2e74fb523
commit
abc6fa05e6
|
@ -152,16 +152,19 @@ if 'patch' not in View.http_method_names:
|
||||||
try:
|
try:
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
|
if markdown.version <= '2.2':
|
||||||
|
HEADERID_EXT_PATH = 'headerid'
|
||||||
|
else:
|
||||||
|
HEADERID_EXT_PATH = 'markdown.extensions.headerid'
|
||||||
|
|
||||||
def apply_markdown(text):
|
def apply_markdown(text):
|
||||||
"""
|
"""
|
||||||
Simple wrapper around :func:`markdown.markdown` to set the base level
|
Simple wrapper around :func:`markdown.markdown` to set the base level
|
||||||
of '#' style headers to <h2>.
|
of '#' style headers to <h2>.
|
||||||
"""
|
"""
|
||||||
|
extensions = [HEADERID_EXT_PATH]
|
||||||
extensions = ['markdown.extensions.headerid']
|
|
||||||
extension_configs = {
|
extension_configs = {
|
||||||
'markdown.extensions.headerid': {
|
HEADERID_EXT_PATH: {
|
||||||
'level': '2'
|
'level': '2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user