コード例 #1
0
    def apply_markdown(text):
        """
        Simple wrapper around :func:`markdown.markdown` to apply our :class:`CustomSetextHeaderProcessor`,
        and also set the base level of '#' style headers to <h2>.
        """
        
        extensions = ['headerid(level=2)']
        safe_mode = False,
        output_format = markdown.DEFAULT_OUTPUT_FORMAT

        md = markdown.Markdown(extensions=markdown.load_extensions(extensions),
                               safe_mode=safe_mode, 
                               output_format=output_format)
        md.parser.blockprocessors['setextheader'] = CustomSetextHeaderProcessor(md.parser)
        return md.convert(text)
コード例 #2
0
    def apply_markdown(text):
        """
        Simple wrapper around :func:`markdown.markdown` to apply our :class:`CustomSetextHeaderProcessor`,
        and also set the base level of '#' style headers to <h2>.
        """
        
        extensions = ['headerid(level=2)']
        safe_mode = False,
        output_format = markdown.DEFAULT_OUTPUT_FORMAT

        md = markdown.Markdown(extensions=markdown.load_extensions(extensions),
                               safe_mode=safe_mode, 
                               output_format=output_format)
        md.parser.blockprocessors['setextheader'] = CustomSetextHeaderProcessor(md.parser)
        return md.convert(text)