File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010TABS_START_REGEX = re .compile (TABS_START )
1111TABS_END_REGEX = re .compile (TABS_END )
1212
13+
1314class 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+
4046class 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
4854def makeExtension (* args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments