1
- Using Markdown as Python Library
2
- ================================
1
+ Using Markdown as a Python Library
2
+ ====================++ ============
3
3
4
4
First and foremost, Python-Markdown is intended to be a python library module
5
5
used by various projects to convert Markdown syntax into HTML.
@@ -17,7 +17,7 @@ The Details
17
17
18
18
Python-Markdown provides two public functions (` markdown.markdown ` and
19
19
` markdown.markdownFromFile ` ) both of which wrap the public class
20
- ` markdown.Markdown ` . If your processing one document at a time, the
20
+ ` markdown.Markdown ` . If you're processing one document at a time, the
21
21
functions will serve your needs. However, if you need to process
22
22
multiple documents, it may be advantageous to create a single instance
23
23
of the ` markdown.Markdown ` class and pass multiple documents through it.
@@ -50,7 +50,7 @@ The following options are available on the `markdown.markdown` function:
50
50
Python-Markdown provides an API for third parties to write extensions to
51
51
the parser adding their own additions or changes to the syntax. A few
52
52
commonly used extensions are shipped with the markdown library. See
53
- the extension documentation for a list of available extensions.
53
+ the [ extension documentation] ( extensions ) for a list of available extensions.
54
54
55
55
The list of extensions may contain instances of extensions or stings of
56
56
extension names. If an extension name is provided as a string, the
@@ -137,7 +137,7 @@ The following options are available on the `markdown.markdown` function:
137
137
138
138
* ` enable_attributes ` : Enable the conversion of attributes. Default: True
139
139
140
- * ` smart_emphasis ` : Treat ` _connected_words_ ` intelegently Default: True
140
+ * ` smart_emphasis ` : Treat ` _connected_words_ ` intelligently Default: True
141
141
142
142
* ` lazy_ol ` : Ignore number of first item of ordered lists. Default: True
143
143
@@ -162,8 +162,8 @@ The following options are available on the `markdown.markdown` function:
162
162
### ` markdown.markdownFromFile(**kwargs) `
163
163
164
164
With a few exceptions, ` markdown.markdownFromFile ` accepts the same options as
165
- ` markdown.markdown ` . It does ** not** accept a ` text ` string. Instead, it accepts
166
- the following required options:
165
+ ` markdown.markdown ` . It does ** not** accept a ` text ` (or Unicode) string.
166
+ Instead, it accepts the following required options:
167
167
168
168
* ` input ` (required): The source text file.
169
169
@@ -173,7 +173,7 @@ the following required options:
173
173
* a readable file-like object,
174
174
* or ` None ` (default) which will read from ` stdin ` .
175
175
176
- * ` output ` : The target which output to written to.
176
+ * ` output ` : The target which output is written to.
177
177
178
178
` output ` may be set to one of three options:
179
179
@@ -182,13 +182,13 @@ the following required options:
182
182
* or ` None ` (default) which will write to ` stdout ` .
183
183
184
184
* ` encoding ` : The encoding of the source text file. Defaults to
185
- "utf-8". The same encoding will always be used for the output file .
185
+ "utf-8". The same encoding will always be used for input and output .
186
186
The 'xmlcharrefreplace' error handler is used when encoding the output.
187
187
188
188
** Note:** This is the only place that decoding and encoding of unicode
189
189
takes place in Python-Markdown. If this rather naive solution does not
190
- meet your special needs, it is suggested that you write your own code
191
- to handle your specific encoding/decoding needs.
190
+ meet your specific needs, it is suggested that you write your own code
191
+ to handle your encoding/decoding needs.
192
192
193
193
### ` markdown.Markdown([**kwargs]) `
194
194
@@ -215,6 +215,10 @@ must be passed to one of two instance methods:
215
215
html1 = md.convert(text1)
216
216
md.reset()
217
217
html2 = md.convert(text2)
218
+
219
+ You can also change calls to ` reset ` togeather:
220
+
221
+ html3 = md.reset().convert(text3)
218
222
219
223
* ` Markdown.convertFile(**kwargs) `
220
224
@@ -223,4 +227,4 @@ must be passed to one of two instance methods:
223
227
` encoding ` ). As with the ` convert ` method, this method should be used to
224
228
process multiple files without creating a new instance of the class for
225
229
each document. State may need to be ` reset ` between each call to
226
- ` convertFile ` as with ` convert ` .
230
+ ` convertFile ` as is the case with ` convert ` .
0 commit comments