当前位置: 首页>>代码示例>>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;未经允许,请勿转载。