markdown: Organize preprocessor priorities in one place.

All of our custom Markdown extensions have priorities that govern
the order in which the preprocessors will be run. It is more
convenient to have these all in one file so that you can easily
discern the order at first glance.

Thanks to Alya Abbott for reporting the bug that led to this
refactoring!
This commit is contained in:
Eeshan Garg
2021-09-17 13:01:36 -04:00
committed by Tim Abbott
parent 6367384510
commit bfbd77ca5c
11 changed files with 66 additions and 14 deletions

View File

@@ -88,6 +88,7 @@ from pygments.lexers import find_lexer_class_by_name
from pygments.util import ClassNotFound
from zerver.lib.exceptions import MarkdownRenderingException
from zerver.lib.markdown.preprocessor_priorities import PREPROCESSOR_PRIORITES
from zerver.lib.tex import render_tex
# Global vars
@@ -162,7 +163,9 @@ class FencedCodeExtension(Extension):
processor = FencedBlockPreprocessor(
md, run_content_validators=self.config["run_content_validators"][0]
)
md.preprocessors.register(processor, "fenced_code_block", 25)
md.preprocessors.register(
processor, "fenced_code_block", PREPROCESSOR_PRIORITES["fenced_code_block"]
)
class ZulipBaseHandler: