From 5edd8af875037408c2a4e26c90b503fbabca615c Mon Sep 17 00:00:00 2001 From: Andrew E Slaughter Date: Sun, 9 Apr 2017 19:46:50 -0600 Subject: [PATCH] Automatically register extension. It doesn't seem necessary to require the extension to register itself when it can be done automatically. Calling the registration method manually makes it easy to forget (e.g., the meta extension) thus not allowing the list to be inspected by other extensions that may require an extension. --- markdown/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/markdown/__init__.py b/markdown/__init__.py index 409f9cfd4..a43a420dc 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -185,6 +185,8 @@ def registerExtensions(self, extensions, configs): ext = self.build_extension(ext, configs.get(ext, {})) if isinstance(ext, Extension): ext.extendMarkdown(self, globals()) + if ext not in self.registeredExtensions: + self.registeredExtensions.append(ext) logger.debug( 'Successfully loaded extension "%s.%s".' % (ext.__class__.__module__, ext.__class__.__name__)