fixes mistune plugin for mistune v3

This commit is contained in:
gridtime 2024-03-04 10:45:20 +01:00
parent e99b7584d2
commit 473205007f
No known key found for this signature in database
GPG Key ID: FB6ACC7A1C9182F8

View File

@ -41,7 +41,10 @@ def plugin_matrix(md):
# Mark colour as high priority as otherwise e.g. <red>(hi) matches the # Mark colour as high priority as otherwise e.g. <red>(hi) matches the
# inline_html rule instead of the colour rule. # inline_html rule instead of the colour rule.
md.inline.rules.insert(1, "colour") md.inline.rules.insert(1, "colour")
md.inline.register_rule("colour", colour, parse_colour) if mistune.__version__.startswith("3"):
md.inline.register("colour", colour, parse_colour)
else:
md.inline.register_rule("colour", colour, parse_colour) # v2
if md.renderer.NAME == "html": if md.renderer.NAME == "html":
md.renderer.register("colour", render_html_colour) md.renderer.register("colour", render_html_colour)