Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions markdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def build_parser(self):
self.inlinePatterns = build_inlinepatterns(self)
self.treeprocessors = build_treeprocessors(self)
self.postprocessors = build_postprocessors(self)
return self

def registerExtensions(self, extensions, configs):
"""
Expand All @@ -147,6 +148,8 @@ def registerExtensions(self, extensions, configs):
'Extension "%s.%s" must be of type: "markdown.Extension".' \
% (ext.__class__.__module__, ext.__class__.__name__))

return self

def build_extension(self, ext_name, configs = []):
"""Build extension by name, then return the module.

Expand Down Expand Up @@ -191,6 +194,7 @@ def build_extension(self, ext_name, configs = []):
def registerExtension(self, extension):
""" This gets called by the extension """
self.registeredExtensions.append(extension)
return self

def reset(self):
"""
Expand All @@ -203,6 +207,8 @@ def reset(self):
if hasattr(extension, 'reset'):
extension.reset()

return self

def set_output_format(self, format):
""" Set the output format for the class instance. """
try:
Expand All @@ -211,6 +217,7 @@ def set_output_format(self, format):
message(CRITICAL,
'Invalid Output Format: "%s". Use one of %s.' \
% (format, self.output_formats.keys()))
return self

def convert(self, source):
"""
Expand Down Expand Up @@ -326,6 +333,8 @@ def convertFile(self, input=None, output=None, encoding=None):
else:
output.write(html.encode(encoding))

return self


"""
EXPORTED FUNCTIONS
Expand Down