From: Waylan L. <wa...@gm...> - 2008-12-09 04:51:10
|
I am please to announce that I'm releasing a new extension that wraps HTML Tidy[1] using the µTidylib [2] python wrapper. Not only does this give the option for prettier output (indentation) but it will output HTML or XHTML painlessly. In fact, any options [3] supported by HTML Tidy can be passed into the extension as configs. Both HTML Tidy and µTidylib will need to installed on your system for this to work. It *will* munge (and may choke on) raw html. A few options that may be useful to many: * output_xhtml: Turns xhtml output on or off. Defaults to 1/on. * indent: Turns indent on or off (use auto for best output). Defaults to 0/off. * show_body_only: Turns addition of <html>, <head> and <body> tags on/off. Defaults to 0/off. Note that the defaults most closely mimic python-markdown's default behavior, only slitly improving on the etree prettify method. However, the options are endless for how this could be used. So to output HTML rather than XHTML (note the ``<hr>`` rather than ``<hr />``): >>> markdown.markdown("foo\n***\nbar", ["html_tidy(output_xhtml=0)"]) u'<p>foo</p>\n<hr>\n<p>bar</p>' The extension is attached for review. My question is: Is this something we want packaged with markdown or should I keep it as a separate library? [1]: http://tidy.sourceforge.net/ [2]: http://utidylib.berlios.de/ [3]: http://tidy.sourceforge.net/docs/quickref.html -- ---- Waylan Limberg wa...@gm... |