mirror of https://github.com/zulip/zulip.git
bugdown: Fix fenced_code for Python-Markdown 2.3
(imported from commit 3954444708e222217407df228f07d2cad402a02b)
This commit is contained in:
parent
64b0106e47
commit
3c40dd3bf3
|
@ -82,9 +82,15 @@ class FencedCodeExtension(markdown.Extension):
|
|||
""" Add FencedBlockPreprocessor to the Markdown instance. """
|
||||
md.registerExtension(self)
|
||||
|
||||
# Newer versions of Python-Markdown (starting at 2.3?) have
|
||||
# a normalize_whitespace preprocessor that needs to go first.
|
||||
position = ('>normalize_whitespace'
|
||||
if 'normalize_whitespace' in md.preprocessors
|
||||
else '_begin')
|
||||
|
||||
md.preprocessors.add('fenced_code_block',
|
||||
FencedBlockPreprocessor(md),
|
||||
"_begin")
|
||||
position)
|
||||
|
||||
|
||||
class FencedBlockPreprocessor(markdown.preprocessors.Preprocessor):
|
||||
|
|
Loading…
Reference in New Issue