diff options
author | Waylan Limberg <waylan@gmail.com> | 2010-08-29 00:22:28 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2010-08-29 00:22:28 -0400 |
commit | 5366b6908de0daa389ac514eb92c8db3e04148db (patch) | |
tree | a695331d4b28d3ede28b8e64461a5208a0e1e675 | |
parent | fb262f7793efd6eda61e9571cc68cfbd5bb1bf9e (diff) | |
download | markdown-5366b6908de0daa389ac514eb92c8db3e04148db.tar.gz markdown-5366b6908de0daa389ac514eb92c8db3e04148db.tar.bz2 markdown-5366b6908de0daa389ac514eb92c8db3e04148db.zip |
Wrapper functions now accept any arguments also accepted by the class, rather than a limited subset. They are also more future proof. By using *args and **kwargs, we should not need to update them if we add/change any arguments or keywords on the class.
-rw-r--r-- | markdown/__init__.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py index 57708fe..1375523 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -335,10 +335,7 @@ Those are the two functions we really mean to export: markdown() and markdownFromFile(). """ -def markdown(text, - extensions = [], - safe_mode = False, - output_format = 'xhtml1'): +def markdown(text, *args, **kwargs): """Convert a markdown string to HTML and return HTML as a unicode string. This is a shortcut function for `Markdown` class to cover the most @@ -362,9 +359,7 @@ def markdown(text, Returns: An HTML document as a string. """ - md = Markdown(extensions=extensions, - safe_mode=safe_mode, - output_format=output_format) + md = Markdown(*args, **kwargs) return md.convert(text) @@ -372,12 +367,9 @@ def markdownFromFile(input = None, output = None, extensions = [], encoding = None, - safe_mode = False, - output_format = 'xhtml1'): + *args, **kwargs): """Read markdown code from a file and write it to a file or a stream.""" - md = Markdown(extensions=extensions, - safe_mode=safe_mode, - output_format=output_format) + md = Markdown(extensions=extensions, *args, **kwargs) md.convertFile(input, output, encoding) |