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


Python markdown.preprocessors方法代碼示例

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


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

示例1: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md: markdown.Markdown, md_globals: Dict[str, Any]) -> None:
        md.preprocessors.add(
            'generate_code_example', APICodeExamplesPreprocessor(md, self.getConfigs()), '_begin',
        )
        md.preprocessors.add(
            'generate_api_description', APIDescriptionPreprocessor(md, self.getConfigs()), '_begin',
        ) 
開發者ID:zulip,項目名稱:zulip,代碼行數:9,代碼來源:markdown_extension.py

示例2: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md: markdown.Markdown, md_globals: Dict[str, Any]) -> None:
        md.preprocessors.add(
            'tabbed_sections', TabbedSectionsPreprocessor(md, self.getConfigs()), '_end') 
開發者ID:zulip,項目名稱:zulip,代碼行數:5,代碼來源:tabbed_sections.py

示例3: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md: markdown.Markdown, md_globals: Dict[str, Any]) -> None:
        """ Add RelativeLinksHelpExtension to the Markdown instance. """
        md.registerExtension(self)
        md.preprocessors.add('help_relative_links', RelativeLinks(), '_begin') 
開發者ID:zulip,項目名稱:zulip,代碼行數:6,代碼來源:help_relative_links.py

示例4: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md: markdown.Markdown, md_globals: Dict[str, Any]) -> None:
        """ Add SettingHelpExtension to the Markdown instance. """
        md.registerExtension(self)
        md.preprocessors.add('setting', Setting(), '_begin') 
開發者ID:zulip,項目名稱:zulip,代碼行數:6,代碼來源:help_settings_links.py

示例5: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md: markdown.Markdown, md_globals: Dict[str, Any]) -> None:
        md.preprocessors.add(
            'generate_api_arguments', APIArgumentsTablePreprocessor(md, self.getConfigs()), '_begin',
        ) 
開發者ID:zulip,項目名稱:zulip,代碼行數:6,代碼來源:api_arguments_table_generator.py

示例6: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md: markdown.Markdown, md_globals: Dict[str, Any]) -> None:
        md.preprocessors.add(
            'generate_return_values', APIReturnValuesTablePreprocessor(md, self.getConfigs()), '_begin',
        ) 
開發者ID:zulip,項目名稱:zulip,代碼行數:6,代碼來源:api_return_values_table_generator.py

示例7: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md, md_globals):
        md.preprocessors.add('CodeBlockPreprocessor', CodeBlockPreprocessor(), '_begin') 
開發者ID:pygments,項目名稱:pygments,代碼行數:4,代碼來源:markdown-processor.py

示例8: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md, md_globals=None):
        md.preprocessors.add("code_isolation",
                             IndentsAsCellOutputPreprocessor(md),
                             "<html_block")
        md.parser.blockprocessors['code'] = IndentsAsCellOutputProcessor(md.parser) 
開發者ID:airbnb,項目名稱:knowledge-repo,代碼行數:7,代碼來源:html.py

示例9: extract_code_blocks

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extract_code_blocks(filename):
    with open(filename) as fin:
        doc = fin.read().split("\n")

    M = markdown.Markdown(extensions=[SpecialFencedCodeExtension()])

    preprocessors = M.preprocessors
    tree_processors = M.treeprocessors

    try:
        version_info = markdown.__version_info__
    except AttributeError:
        version_info = markdown.version_info

    # Markdown 3.* stores the processors in a class that can be iterated directly.
    # Markdown 2.* stores them in a dict, so we have to pull out the values.
    if version_info[0] == 2:
        # Note: `markdown.version_info` will be deprecated in favor of
        # `markdown.__version_info__` in later versions of Markdown.
        preprocessors = preprocessors.values()
        tree_processors = tree_processors.values()

    for prep in preprocessors:
        doc = prep.run(doc)

    root = M.parser.parseDocument(doc).getroot()

    for treeproc in tree_processors:
        newRoot = treeproc.run(root)
        if newRoot is not None:
            root = newRoot

    return SpecialFencePreprocessor.EXAMPLES 
開發者ID:cwacek,項目名稱:python-jsonschema-objects,代碼行數:35,代碼來源:markdown_support.py

示例10: extendMarkdown

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def extendMarkdown(self, md, md_globals=None):
        """ Add FencedBlockPreprocessor to the Markdown instance. """
        md.registerExtension(self)

        if markdown.version_info[0] >= 3:
            md.preprocessors.register(
                SpecialFencePreprocessor(md), "fenced_code_block", 10
            )
        else:
            md.preprocessors.add(
                "fenced_code_block",
                SpecialFencePreprocessor(md),
                ">normalize_whitespace",
            ) 
開發者ID:cwacek,項目名稱:python-jsonschema-objects,代碼行數:16,代碼來源:markdown_support.py

示例11: md_filter_add_syntax_highlight

# 需要導入模塊: import markdown [as 別名]
# 或者: from markdown import preprocessors [as 別名]
def md_filter_add_syntax_highlight(md):
        md.preprocessors.add('highlight', CodeBlockPreprocessor(), "_begin")
        return True 
開發者ID:BeanWei,項目名稱:Dailyfresh-B2C,代碼行數:5,代碼來源:compat.py


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