Skip to content

Commit 51e3e38

Browse files
author
Sychevskyi Henadii
committed
ASUP-340
1 parent c383169 commit 51e3e38

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

plugins/markdown-tabs/markdown-tabs.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
TABS_START_REGEX = re.compile(TABS_START)
1111
TABS_END_REGEX = re.compile(TABS_END)
1212

13+
1314
class TabsPreprocessor(Preprocessor):
15+
def __init__(self, md):
16+
# Markdown 3.x expects the Markdown instance here
17+
super(TabsPreprocessor, self).__init__(md)
18+
1419
def run(self, lines):
1520
new_lines = []
1621
skip_empty_line = False
@@ -37,12 +42,13 @@ def run(self, lines):
3742

3843
return new_lines
3944

45+
4046
class TabsExtension(Extension):
4147
# Compatible with Markdown 2.x (md, md_globals) and 3.x (md) signatures
4248
def extendMarkdown(self, md, md_globals=None):
4349
md.registerExtension(self)
44-
# Old-style assignment still works; no need for md.preprocessors.register here
45-
md.preprocessors["tabs"] = TabsPreprocessor()
50+
# Use the modern registry API; this works across Markdown 3.x
51+
md.preprocessors.register(TabsPreprocessor(md), 'tabs', 25)
4652

4753

4854
def makeExtension(*args, **kwargs):

0 commit comments

Comments
 (0)