aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions/__init__.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2018-07-31 13:30:02 -0400
committerGitHub <noreply@github.com>2018-07-31 13:30:02 -0400
commit7dad12c07e3e701da42474696398cb32e5c9979f (patch)
tree2a2bd4d52e871d64c7e488b55a3440015a9bb4e8 /markdown/extensions/__init__.py
parentf261ffd065bcfea13d41a9861232155816c5933f (diff)
downloadmarkdown-7dad12c07e3e701da42474696398cb32e5c9979f.tar.gz
markdown-7dad12c07e3e701da42474696398cb32e5c9979f.tar.bz2
markdown-7dad12c07e3e701da42474696398cb32e5c9979f.zip
Deprecate md_globals from extension API. (#697)
In the past, most of the config was defined using globals. Today all of the config is held on the class instance. Therefore, the `md_globals` parameter is no longer necessary.
Diffstat (limited to 'markdown/extensions/__init__.py')
-rw-r--r--markdown/extensions/__init__.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/markdown/extensions/__init__.py b/markdown/extensions/__init__.py
index 262e17e..3ec89ac 100644
--- a/markdown/extensions/__init__.py
+++ b/markdown/extensions/__init__.py
@@ -21,6 +21,7 @@ License: BSD (see LICENSE.md for details).
"""
from __future__ import unicode_literals
+import warnings
from ..util import parseBoolValue
@@ -71,7 +72,22 @@ class Extension(object):
for key, value in items:
self.setConfig(key, value)
- def extendMarkdown(self, md, md_globals):
+ def _extendMarkdown(self, *args):
+ """ Private wrapper around extendMarkdown. """
+ md = args[0]
+ try:
+ self.extendMarkdown(md)
+ except TypeError:
+ # Must be a 2.x extension. Pass in a dumby md_globals.
+ self.extendMarkdown(md, {})
+ warnings.warn(
+ "The 'md_globals' parameter of '{0}.{1}.extendMarkdown' is "
+ "deprecated.".format(self.__class__.__module__, self.__class__.__name__),
+ category=DeprecationWarning,
+ stacklevel=2
+ )
+
+ def extendMarkdown(self, md):
"""
Add the various proccesors and patterns to the Markdown Instance.