Replaced markdown.processors.add with markdown.processors.register.

markdown.processors.add has been deprecated and removed, see
a767b2daaa (diff-73515afd0109793374fb1748b8642ce5099d18d6924a8a06420da6e219eea32cL415)
This commit is contained in:
Fabio Manganiello 2022-08-02 17:38:51 +02:00
parent 5a358a870c
commit eef19bb7b8

View file

@ -229,11 +229,9 @@ class LaTeXPostprocessor(markdown.postprocessors.Postprocessor):
"""This post processor extension just allows us to further
refine, if necessary, the document after it has been parsed."""
# noinspection PyMethodMayBeStatic
def run(self, text):
def run(self, lines):
# Inline a style for default behavior
text = img_css + text
return text
return [img_css] + lines
class MarkdownLatex(markdown.Extension):
@ -241,8 +239,14 @@ class MarkdownLatex(markdown.Extension):
def extendMarkdown(self, md):
# Our base LaTeX extension
md.preprocessors.add('latex',
LaTeXPreprocessor(self), ">html_block")
# Our cleanup postprocessing extension
md.postprocessors.add('latex',
LaTeXPostprocessor(self), ">amp_substitute")
md.preprocessors.register(
LaTeXPreprocessor(self),
'latex',
0,
)
md.preprocessors.register(
LaTeXPostprocessor(self),
'latex',
1,
)