diff options
author | Waylan Limberg <waylan@gmail.com> | 2009-08-23 14:42:52 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2009-08-23 14:42:52 -0400 |
commit | b688bf59dee2ed1552c0b232a43066ba18393ab0 (patch) | |
tree | b5c8bc09beee2ad2b2cfe28d53f6422c7907f9cb /docs/using_as_module.txt | |
parent | b4ce140d4e0e9839eb8e95f26165b8584441a5f2 (diff) | |
download | markdown-b688bf59dee2ed1552c0b232a43066ba18393ab0.tar.gz markdown-b688bf59dee2ed1552c0b232a43066ba18393ab0.tar.bz2 markdown-b688bf59dee2ed1552c0b232a43066ba18393ab0.zip |
Fixed Ticket 43. Apparenlty ElementTree does not recognize 'utf8' as an alias of 'utf-8' and outputs invalid xml. We never noticed as stripTopLevelTags removes the offending fragment. However, there are legitimate uses for turning off stripTopLevelTags. Therefore, from now on we will be using 'utf-8' internally. Thanks to Mark Eichin for the report.
Diffstat (limited to 'docs/using_as_module.txt')
-rw-r--r-- | docs/using_as_module.txt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/using_as_module.txt b/docs/using_as_module.txt index cfeb88d..130d0a7 100644 --- a/docs/using_as_module.txt +++ b/docs/using_as_module.txt @@ -20,13 +20,13 @@ string should work) and returns output as Unicode. Do not pass encoded strings If your input is encoded, e.g. as UTF-8, it is your responsibility to decode it. E.g.: - input_file = codecs.open("some_file.txt", mode="r", encoding="utf8") + input_file = codecs.open("some_file.txt", mode="r", encoding="utf-8") text = input_file.read() html = markdown.markdown(text, extensions) If you later want to write it to disk, you should encode it yourself: - output_file = codecs.open("some_file.html", "w", encoding="utf8") + output_file = codecs.open("some_file.html", "w", encoding="utf-8") output_file.write(html) More Options @@ -61,7 +61,7 @@ The ``Markdown`` class has the method ``convertFile`` which reads in a file and writes out to a file-like-object: md = markdown.Markdown() - md.convertFile(input="in.txt", output="out.html", encoding="utf8") + md.convertFile(input="in.txt", output="out.html", encoding="utf-8") The markdown module also includes a shortcut function ``markdownFromFile`` that wraps the above method. @@ -69,7 +69,7 @@ wraps the above method. markdown.markdownFromFile(input="in.txt", output="out.html", extensions=[], - encoding="utf8", + encoding="utf-8", safe=False) In either case, if the ``output`` keyword is passed a file name (i.e.: |