Here is a new version that I am hoping to put on the website in a few
days, once I get around to changing the documentation. The basic
changes are:
1. A few bug fixes, including Sergej's patch for the ampersand problem
discussed on the list in July.
2. Switched to using optparse for command line processing. This means
you need Python 2.3 or higher to use advanced command line options (or
install optparse). However, the script _does_ work with lower
versions of python - just with very basic command line handing.
3. Proper handling of unicode
4. The extensions work a bit differently now (once they are upgraded).
Each extension should be in a module that is prefixed with mdx_, e.g.
mdx_footnotes.py. It should also implement a module-level function
makeExtension() which should return the extension object. The
extension class should implement extendMarkdown as before. The
extensions can then be loaded from the command line using the
following syntax:
markdown.py -xfootnotes mytext.txt
or, possibly
markdown.py -xfootnotes -xtoc -xmyotherext mytext.txt
Note that in this case Markdown is going to go looking for the other
extensions in the mdx_toc and mdx_myotherext modules.
The extensions can be loaded programmatically in the same way:
markdown("lorem [^1]\n\n[^1]ipsum", extensions=['footnotes'])
(If you use the Markdown class directly you will have to load the
extensions manually for now, but I will move the loading logic into
the class itself, so that there is something like
md.loadExtensions(['footnotes'].)
The code is at http://www.freewisdom.org/projects/python-markdown/python-markdown-1-6-rc1.tgz
- yuri
--
http://www.freewisdom.org/
|