Register extensions with this instance of Markdown. Keyword aurguments: * extensions: A list of extensions, which can either be strings or objects. See the docstring on Markdown. * configs: A dictionary mapping module names to config options.
(self, extensions, configs)
| 314 | self.reset() |
| 315 | |
| 316 | def registerExtensions(self, extensions, configs): |
| 317 | """ |
| 318 | Register extensions with this instance of Markdown. |
| 319 | |
| 320 | Keyword aurguments: |
| 321 | |
| 322 | * extensions: A list of extensions, which can either |
| 323 | be strings or objects. See the docstring on Markdown. |
| 324 | * configs: A dictionary mapping module names to config options. |
| 325 | |
| 326 | """ |
| 327 | for ext in extensions: |
| 328 | if isinstance(ext, str): |
| 329 | ext = load_extension(ext, configs.get(ext, [])) |
| 330 | if isinstance(ext, Extension): |
| 331 | try: |
| 332 | ext.extendMarkdown(self, globals()) |
| 333 | except NotImplementedError as e: |
| 334 | message(ERROR, e) |
| 335 | else: |
| 336 | message(ERROR, 'Extension "%s.%s" must be of type: "markdown.Extension".' \ |
| 337 | % (ext.__class__.__module__, ext.__class__.__name__)) |
| 338 | |
| 339 | def registerExtension(self, extension): |
| 340 | """ This gets called by the extension """ |
no test coverage detected