Python markdown.extensions.Extension() Examples
The following are 2
code examples of markdown.extensions.Extension().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
markdown.extensions
, or try the search function
.
Example #1
Source File: extension.py From mkdocstrings with ISC License | 5 votes |
def __init__(self, config: dict, **kwargs) -> None: """ Initialization method. Arguments: config: The configuration items from `mkdocs` and `mkdocstrings` that must be passed to the block processor when instantiated in [`extendMarkdown`][mkdocstrings.extension.MkdocstringsExtension.extendMarkdown]. kwargs: Keyword arguments used by `markdown.extensions.Extension`. """ super().__init__(**kwargs) self._config = config
Example #2
Source File: __init__.py From sublime-markdown-popups with MIT License | 5 votes |
def registerExtensions(self, extensions, configs): # noqa """ Register extensions with this instance of Markdown. Keyword arguments: * `extensions`: A list of extensions, which can either be strings or objects. See the docstring on Markdown. * `configs`: A dictionary mapping module names to configuration options. """ from markdown import util from markdown.extensions import Extension for ext in extensions: try: if isinstance(ext, util.string_type): ext = self.build_extension(ext, configs.get(ext, {})) if isinstance(ext, Extension): ext._extendMarkdown(self) elif ext is not None: raise TypeError( 'Extension "%s.%s" must be of type: "markdown.Extension"' % (ext.__class__.__module__, ext.__class__.__name__) ) except Exception: # We want to gracefully continue even if an extension fails. _log('Failed to load markdown module!') _debug(traceback.format_exc(), ERROR) return self