(self, *args, **kwargs)
Creates a new Markdown instance.

        Keyword arguments:

        * extensions: A list of extensions.
           If they are of type string, the module mdx_name.py will be loaded.
           If they are a subclass of markdown.Extension, they will be used
           as-is.
        * extension_configs: Configuration settingis for extensions.
        * output_format: Format of output. Supported formats are:
            * "xhtml1": Outputs XHTML 1.x. Default.
            * "xhtml5": Outputs XHTML style tags of HTML 5
            * "xhtml": Outputs latest supported version of XHTML (currently XHTML 1.1).
            * "html4": Outputs HTML 4
            * "html5": Outputs HTML style tags of HTML 5
            * "html": Outputs latest supported version of HTML (currently HTML 4).
            Note that it is suggested that the more specific formats ("xhtml1"
            and "html4") be used as "xhtml" or "html" may change in the future
            if it makes sense at that time.
        * safe_mode: Disallow raw html. One of "remove", "replace" or "escape".
        * html_replacement_text: Text used when safe_mode is set to "replace".
        * tab_length: Length of tabs in the source. Default: 4
        * enable_attributes: Enable the conversion of attributes. Default: True
        * smart_emphasis: Treat `_connected_words_` intelegently Default: True
        * lazy_ol: Ignore number of first item of ordered lists. Default: True
Creates a new Markdown instance.
Creates a new Markdown instance .
def __init__(self, *args, **kwargs):
        """
        Creates a new Markdown instance.

        Keyword arguments:

        * extensions: A list of extensions.
           If they are of type string, the module mdx_name.py will be loaded.
           If they are a subclass of markdown.Extension, they will be used
           as-is.
        * extension_configs: Configuration settingis for extensions.
        * output_format: Format of output. Supported formats are:
            * "xhtml1": Outputs XHTML 1.x. Default.
            * "xhtml5": Outputs XHTML style tags of HTML 5
            * "xhtml": Outputs latest supported version of XHTML (currently XHTML 1.1).
            * "html4": Outputs HTML 4
            * "html5": Outputs HTML style tags of HTML 5
            * "html": Outputs latest supported version of HTML (currently HTML 4).
            Note that it is suggested that the more specific formats ("xhtml1"
            and "html4") be used as "xhtml" or "html" may change in the future
            if it makes sense at that time.
        * safe_mode: Disallow raw html. One of "remove", "replace" or "escape".
        * html_replacement_text: Text used when safe_mode is set to "replace".
        * tab_length: Length of tabs in the source. Default: 4
        * enable_attributes: Enable the conversion of attributes. Default: True
        * smart_emphasis: Treat `_connected_words_` intelegently Default: True
        * lazy_ol: Ignore number of first item of ordered lists. Default: True

        """

        # For backward compatability, loop through old positional args
        pos = ['extensions', 'extension_configs', 'safe_mode', 'output_format']
        c = 0
        for arg in args:
            if not kwargs.has_key(pos[c]):
                kwargs[pos[c]] = arg
            c += 1
            if c == len(pos):
                # ignore any additional args
                break

        # Loop through kwargs and assign defaults
        for option, default in self.option_defaults.items():
            setattr(self, option, kwargs.get(option, default))

        self.safeMode = kwargs.get('safe_mode', False)
        if self.safeMode and not kwargs.has_key('enable_attributes'):
            # Disable attributes in safeMode when not explicitly set
            self.enable_attributes = False

        self.registeredExtensions = []
        self.docType = ""
        self.stripTopLevelTags = True

        self.build_parser()

        self.references = {}
        self.htmlStash = util.HtmlStash()
        self.registerExtensions(extensions=kwargs.get('extensions', []),
                                configs=kwargs.get('extension_configs', {}))
        self.set_output_format(kwargs.get('output_format', 'xhtml1'))
        self.reset()
def __init__ ( self , * args , * * kwargs ) : # For backward compatability, loop through old positional args pos = [ 'extensions' , 'extension_configs' , 'safe_mode' , 'output_format' ] c = 0 for arg in args : if not kwargs . has_key ( pos [ c ] ) : kwargs [ pos [ c ] ] = arg c += 1 if c == len ( pos ) : # ignore any additional args break # Loop through kwargs and assign defaults for option , default in self . option_defaults . items ( ) : setattr ( self , option , kwargs . get ( option , default ) ) self . safeMode = kwargs . get ( 'safe_mode' , False ) if self . safeMode and not kwargs . has_key ( 'enable_attributes' ) : # Disable attributes in safeMode when not explicitly set self . enable_attributes = False self . registeredExtensions = [ ] self . docType = "" self . stripTopLevelTags = True self . build_parser ( ) self . references = { } self . htmlStash = util . HtmlStash ( ) self . registerExtensions ( extensions = kwargs . get ( 'extensions' , [ ] ) , configs = kwargs . get ( 'extension_configs' , { } ) ) self . set_output_format ( kwargs . get ( 'output_format' , 'xhtml1' ) ) self . reset ( )