From: Thomas t. C. <tte...@gm...> - 2010-08-29 11:15:36
|
Since I can't seem to find an issue tracker, I'm posting this to the mailing list. Please note that I'm not subscribed. Using Markdown 2.0.3. At the bottom of http://www.freewisdom.org/projects/python-markdown/Writing_Extensions it says: > However, Markdown will also accept an already existing instance of an extension. For example: > > import markdown > import myextension > configs = {...} > myext = myextension.MyExtension(configs=configs) > md = markdown.Markdown(extensions=[myext]) This is partly true, and the code works. However, one would expect the same thing to work when using the shortcut functions markdown() and markdownFromFile(). But the former is defined as follows: def markdown(text, extensions = [], safe_mode = False, output_format = DEFAULT_OUTPUT_FORMAT): md = Markdown(extensions=load_extensions(extensions), safe_mode=safe_mode, output_format=output_format) md.convertFile(input, output, encoding) The load_extensions function expects a list of `basestring`s, and chokes on Extension objects. The extra call seems redundant. Is there a reason for this implementation, or is it better to remove the call to load_extensions and pass the list of extensions directly, like this? md = Markdown(extensions=extensions, safe_mode=safe_mode, output_format=output_format) As an aside, the markdown() and markdownFromFile() functions don't accept extension_configs either, which also seems unnecessarily limiting. Thomas |