MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / registerExtensions

Method registerExtensions

markdown/__init__.py:316–337  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 2

__init__Method · 0.95
extendMarkdownMethod · 0.80

Calls 4

load_extensionFunction · 0.85
messageFunction · 0.85
getMethod · 0.45
extendMarkdownMethod · 0.45

Tested by

no test coverage detected