diff options
author | John Sullivan <johnsullivan@khanacademy.org> | 2014-04-19 11:36:44 -0700 |
---|---|---|
committer | John Sullivan <johnsullivan@khanacademy.org> | 2014-04-19 11:36:44 -0700 |
commit | 9a2211a0447f8b3e019e47ca23b4648f9c321258 (patch) | |
tree | 991967f767a7a089a135a822f9eb322804b9086c /docs/reference.txt | |
parent | 51713a10e3de1cbf0b29936d81dc061a9f73b819 (diff) | |
download | markdown-9a2211a0447f8b3e019e47ca23b4648f9c321258.tar.gz markdown-9a2211a0447f8b3e019e47ca23b4648f9c321258.tar.bz2 markdown-9a2211a0447f8b3e019e47ca23b4648f9c321258.zip |
Emphasized proper use of reset method in docs.
This is related to waylan/Python-Markdown#305.
Diffstat (limited to 'docs/reference.txt')
-rw-r--r-- | docs/reference.txt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/docs/reference.txt b/docs/reference.txt index b627c46..5a7490a 100644 --- a/docs/reference.txt +++ b/docs/reference.txt @@ -25,10 +25,11 @@ The Details Python-Markdown provides two public functions ([`markdown.markdown`](#markdown) and [`markdown.markdownFromFile`](#markdownFromFile)) both of which wrap the public class [`markdown.Markdown`](#Markdown). If you're processing one -document at a time, the functions will serve your needs. However, if you need +document at a time, these functions will serve your needs. However, if you need to process multiple documents, it may be advantageous to create a single instance of the `markdown.Markdown` class and pass multiple documents through -it. +it. If you do use a single instance though, make sure to call the `reset` +method appropriately ([see below](#convert)). ### `markdown.markdown (text [, **kwargs])` {: #markdown } @@ -282,17 +283,19 @@ string must be passed to one of two instance methods: html1 = md.convert(text1) html2 = md.convert(text2) - Note that depending on which options and/or extensions are being used, - the parser may need its state reset between each call to `convert`. + Depending on which options and/or extensions are being used, the parser may + need its state reset between each call to `convert`, otherwise performance + can degrade drastically: html1 = md.convert(text1) md.reset() html2 = md.convert(text2) - You can also chain calls to `reset` together: + To make this easier, you can also chain calls to `reset` together: html3 = md.reset().convert(text3) + * `Markdown.convertFile(**kwargs)`{: #convertFile } The arguments of this method are identical to the arguments of the same |