From eef19bb7b8c0c9c6b33cd625de075762dbe3d312 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 2 Aug 2022 17:38:51 +0200 Subject: [PATCH] Replaced markdown.processors.add with markdown.processors.register. markdown.processors.add has been deprecated and removed, see https://github.com/Python-Markdown/markdown/commit/a767b2daaad78ba32d45a4f1dabb7c5e218f030a#diff-73515afd0109793374fb1748b8642ce5099d18d6924a8a06420da6e219eea32cL415 --- madblog/latex.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/madblog/latex.py b/madblog/latex.py index f43b895..fa2a2ef 100644 --- a/madblog/latex.py +++ b/madblog/latex.py @@ -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, + )