mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-13 01:32:34 +03:00
markdown.blockprocessors exists only if markdown version < 2.1
This commit is contained in:
parent
e53c819cc7
commit
8fa8776461
|
@ -371,6 +371,16 @@ else:
|
|||
try:
|
||||
import markdown
|
||||
|
||||
def apply_markdown(text):
|
||||
"""
|
||||
Simple wrapper around :func:`markdown.markdown` to set the base level
|
||||
of '#' style headers to <h2>.
|
||||
"""
|
||||
|
||||
extensions = ['headerid(level=2)']
|
||||
safe_mode = False,
|
||||
|
||||
if markdown.version_info < (2, 1):
|
||||
class CustomSetextHeaderProcessor(markdown.blockprocessors.BlockProcessor):
|
||||
"""
|
||||
Class for markdown < 2.1
|
||||
|
@ -399,16 +409,7 @@ try:
|
|||
# Block contains additional lines. Add to master blocks for later.
|
||||
blocks.insert(0, '\n'.join(lines[2:]))
|
||||
|
||||
def apply_markdown(text):
|
||||
"""
|
||||
Simple wrapper around :func:`markdown.markdown` to set the base level
|
||||
of '#' style headers to <h2>.
|
||||
"""
|
||||
|
||||
extensions = ['headerid(level=2)']
|
||||
safe_mode = False,
|
||||
|
||||
if markdown.version_info < (2, 1):
|
||||
output_format = markdown.DEFAULT_OUTPUT_FORMAT
|
||||
|
||||
md = markdown.Markdown(extensions=markdown.load_extensions(extensions),
|
||||
|
|
Loading…
Reference in New Issue
Block a user