mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
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:
@@ -5,6 +5,8 @@ from markdown import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.preprocessors import Preprocessor
|
||||
|
||||
from zerver.lib.markdown.preprocessor_priorities import PREPROCESSOR_PRIORITES
|
||||
|
||||
# There is a lot of duplicated code between this file and
|
||||
# help_settings_links.py. So if you're making a change here consider making
|
||||
# it there as well.
|
||||
@@ -73,7 +75,9 @@ class RelativeLinksHelpExtension(Extension):
|
||||
def extendMarkdown(self, md: Markdown) -> None:
|
||||
"""Add RelativeLinksHelpExtension to the Markdown instance."""
|
||||
md.registerExtension(self)
|
||||
md.preprocessors.register(RelativeLinks(), "help_relative_links", 520)
|
||||
md.preprocessors.register(
|
||||
RelativeLinks(), "help_relative_links", PREPROCESSOR_PRIORITES["help_relative_links"]
|
||||
)
|
||||
|
||||
|
||||
relative_help_links: Optional[bool] = None
|
||||
|
||||
Reference in New Issue
Block a user