summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2018-01-12 22:48:41 -0500
committerGitHub <noreply@github.com>2018-01-12 22:48:41 -0500
commitcd7324333a995eeb62a3e6eacdb3b179c6256133 (patch)
treed26faeb19e7ebee577df752e1c622ae15475ca42 /setup.py
parentd4de20b77ae2e522fe1a5c730b426a5b60ac86f5 (diff)
downloadpython-markdown-cd7324333a995eeb62a3e6eacdb3b179c6256133.tar.gz
Refactor Extension loading (#627)
Deprecated naming support is removed: * Removed special treatment for modules in `markdown.extensions` * Removed support for `mdx_` prefixes. Support for Entry Point names added: Support for "short names" are now implemented with entry points. Therefore all the users who call extension names as `toc` will not get errors as the builtin extensions all have entry points defined which match the old "short names" for modules in `markdown.extensions`. The benefit is that any extension can offer the same support without requiring the user to manually copy a file to that location on the file system (way to many extension authors have included such instructions in their installation documentation). The one odd thing about this is that we have been issuing a DeprecationWarning for short names and now they are fully supported again. But I think it's the right thing to do. Support for using dot notation is not removed. After all, it was never deprecated. And we shouldn't "force" entry points. There are plenty of reasons why users may not want that and not all of them can be resolved by using class instances instead. All of the following ways to load an extension are valid: # Class instance from markdown.extensions.toc import TocExtension markdown.markdown(src, extensions=[TocExtension()] # Entry point name markdown.markdown(src, extensions=['toc']) # Dot notation with class markdown.markdown(src, extensions=['markdown.extensions.toc:TocExtension']) # Dot notation without class markdown.markdown(src, extensions=['markdown.extensions.toc'])
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 6f0a1e7..73c7ab3 100755
--- a/setup.py
+++ b/setup.py
@@ -59,6 +59,25 @@ setup(
entry_points={
'console_scripts': [
'%s = markdown.__main__:run' % SCRIPT_NAME,
+ ],
+ # Register the built in extensions
+ 'markdown.extensions': [
+ 'abbr = markdown.extensions.abbr:AbbrExtension',
+ 'admonition = markdown.extensions.admonition:AdmonitionExtension',
+ 'attr_list = markdown.extensions.attr_list:AttrListExtension',
+ 'codehilite = markdown.extensions.codehilite:CodeHiliteExtension',
+ 'def_list = markdown.extensions.def_list:DefListExtension',
+ 'extra = markdown.extensions.extra:ExtraExtension',
+ 'fenced_code = markdown.extensions.fenced_code:FencedCodeExtension',
+ 'footnotes = markdown.extensions.footnotes:FootnoteExtension',
+ 'meta = markdown.extensions.meta:MetaExtension',
+ 'nl2br = markdown.extensions.nl2br:Nl2BrExtension',
+ 'sane_lists = markdown.extensions.sane_lists:SaneListExtension',
+ 'smart_strong = markdown.extensions.smart_strong:SmartEmphasisExtension',
+ 'smarty = markdown.extensions.smarty:SmartyExtension',
+ 'tables = markdown.extensions.tables:TableExtension',
+ 'toc = markdown.extensions.toc:TocExtension',
+ 'wikilinks = markdown.extensions.wikilinks:WikiLinkExtension',
]
},
classifiers=[