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