當前位置: 首頁>>代碼示例>>Python>>正文


Python extensions.Extension方法代碼示例

本文整理匯總了Python中markdown.extensions.Extension方法的典型用法代碼示例。如果您正苦於以下問題:Python extensions.Extension方法的具體用法?Python extensions.Extension怎麽用?Python extensions.Extension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在markdown.extensions的用法示例。


在下文中一共展示了extensions.Extension方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from markdown import extensions [as 別名]
# 或者: from markdown.extensions import Extension [as 別名]
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 
開發者ID:pawamoy,項目名稱:mkdocstrings,代碼行數:13,代碼來源:extension.py

示例2: registerExtensions

# 需要導入模塊: from markdown import extensions [as 別名]
# 或者: from markdown.extensions import Extension [as 別名]
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 
開發者ID:facelessuser,項目名稱:sublime-markdown-popups,代碼行數:34,代碼來源:__init__.py


注:本文中的markdown.extensions.Extension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。