diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2014-08-27 14:59:40 -0400 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2014-08-27 14:59:40 -0400 |
commit | e98ac74737c1f28ec730fa5c645062e0e0d5702b (patch) | |
tree | ec4400643c52c1441c61d9fe994b574b48170006 /docs/release-2.5.txt | |
parent | 44e718ed82ed4c8e8e0f0fe1dbdb73d441747b19 (diff) | |
download | markdown-e98ac74737c1f28ec730fa5c645062e0e0d5702b.tar.gz markdown-e98ac74737c1f28ec730fa5c645062e0e0d5702b.tar.bz2 markdown-e98ac74737c1f28ec730fa5c645062e0e0d5702b.zip |
Allow named extensions to specify the Class Name
If you were to import the class like this:
from path.to.module import SomeExtensionClass
Then the named extension would be the string:
"path.to.module:SomeExtensionClass"
This should simplify loading extensions from the command line or
template filters -- expecially when multiple extensions are defined
in a single python module.
The docs still need updating. I'm waiting to update the docs after
implementing #335 and #336 as that will require a major refactor of
that section of the docs anyway.
Diffstat (limited to 'docs/release-2.5.txt')
-rw-r--r-- | docs/release-2.5.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/release-2.5.txt b/docs/release-2.5.txt index eb9c44c..ea351b0 100644 --- a/docs/release-2.5.txt +++ b/docs/release-2.5.txt @@ -36,6 +36,36 @@ languages other than English. Thanks to [Martin Altmayer] for implementing this [Smarty Extension]: extensions/smarty.html [Martin Altmayer]:https://github.com/MartinAltmayer +* Named Extensions (strings passed to the [`extensions`][ex] keyword of `markdown.Markdown`) + can now point to any module and/or Class on your PYTHONPATH. While dot notation was + previously supported, a module could not be at the root of your PYTHONPATH. The name had + to contain at least one dot (requiring it to be a submodule). This restriction no longer + exists. + + Additionaly, a Class may be specified in the name. The class must be at the end of the + name (usig dot notation from PYTHONPATH) and seperated by a colon from the module. + + Therefore, if you were to import the class like this: + + from path.to.module import SomeExtensionClass + + Then the named extension would be the string: + + "path.to.module:SomeExtensionClass" + + This allows multiple extensions to be implemented within the same module and still + accessable when the user isn't able to import the extension directly (perhaps from + a template filter or the command line). + + This also means that extension modules are no longer required to include the + `makeExtension` funtion which returns an instance of the extension class. However, + if the user does not specify the class name (she only provides `"path.to.module"`) + the extension will fail to load without the `makeExtension` function included in + the module. Extension authors will want to document carfully what is required to + load their extensions. + +[ex]: reference.html#extensions + * The Extension Configuration code has been refactord to make it a little easier for extension authors to work with config settings. As a result, the [`extension_configs`][ec] keyword now accepts a dictionary rather than requiring |