Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
c2e94709
Commit
c2e94709
authored
Jan 19, 2016
by
Xavier Ordoquy
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3842 from linovia/markdown-compat
Markdown compat (overtakes #3604)
parents
50749c47
8ea7d6b5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
requirements/requirements-optionals.txt
+1
-1
rest_framework/compat.py
+13
-4
No files found.
requirements/requirements-optionals.txt
View file @
c2e94709
# Optional packages which may be used with REST framework.
# Optional packages which may be used with REST framework.
markdown==2.
5.2
markdown==2.
6.4
django-guardian==1.3.2
django-guardian==1.3.2
django-filter==0.10.0
django-filter==0.10.0
rest_framework/compat.py
View file @
c2e94709
...
@@ -153,16 +153,25 @@ if 'patch' not in View.http_method_names:
...
@@ -153,16 +153,25 @@ 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
=
[
'headerid(level=2)'
]
extension_configs
=
{
safe_mode
=
False
HEADERID_EXT_PATH
:
{
md
=
markdown
.
Markdown
(
extensions
=
extensions
,
safe_mode
=
safe_mode
)
'level'
:
'2'
}
}
md
=
markdown
.
Markdown
(
extensions
=
extensions
,
extension_configs
=
extension_configs
)
return
md
.
convert
(
text
)
return
md
.
convert
(
text
)
except
ImportError
:
except
ImportError
:
apply_markdown
=
None
apply_markdown
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment