diff options
-rw-r--r-- | docs/extensions/code_hilite.txt | 4 | ||||
-rw-r--r-- | docs/extensions/header_id.txt | 4 | ||||
-rw-r--r-- | docs/extensions/index.txt | 2 | ||||
-rw-r--r-- | docs/release-2.3.txt | 18 | ||||
-rw-r--r-- | docs/siteindex.txt | 5 | ||||
-rw-r--r-- | markdown/extensions/html_tidy.py | 71 |
6 files changed, 22 insertions, 82 deletions
diff --git a/docs/extensions/code_hilite.txt b/docs/extensions/code_hilite.txt index 2e15e58..116ad0f 100644 --- a/docs/extensions/code_hilite.txt +++ b/docs/extensions/code_hilite.txt @@ -1,8 +1,8 @@ title: CodeHilite Extension prev_title: Admonition Extension prev_url: admonition.html -next_title: HTML Tidy Extension -next_url: html_tidy.html +next_title: HeaderId Extension +next_url: header_id.html CodeHilite ========== diff --git a/docs/extensions/header_id.txt b/docs/extensions/header_id.txt index 255d35c..c1739a0 100644 --- a/docs/extensions/header_id.txt +++ b/docs/extensions/header_id.txt @@ -1,6 +1,6 @@ title: HeaderId Extension -prev_title: HTML Tidy Extension -prev_url: html_tidy.html +prev_title: CodeHilite Extension +prev_url: code_hilite.html next_title: Meta-Data Extension next_url: meta_data.html diff --git a/docs/extensions/index.txt b/docs/extensions/index.txt index 934c1d6..2137a22 100644 --- a/docs/extensions/index.txt +++ b/docs/extensions/index.txt @@ -49,7 +49,6 @@ Extension | "Name" [Smart Strong][] | `smart_strong` [Admonition][] | `admonition` [CodeHilite][] | `codehilite` -[HTML Tidy][] | `html_tidy` [HeaderId] | `headerid` [Meta-Data] | `meta` [New Line to Break] | `nl2br` @@ -67,7 +66,6 @@ Extension | "Name" [Smart Strong]: smart_strong.html [Admonition]: admonition.html [CodeHilite]: code_hilite.html -[HTML Tidy]: html_tidy.html [HeaderId]: header_id.html [Meta-Data]: meta_data.html [New Line to Break]: nl2br.html diff --git a/docs/release-2.3.txt b/docs/release-2.3.txt index 146ab53..574bdf6 100644 --- a/docs/release-2.3.txt +++ b/docs/release-2.3.txt @@ -8,9 +8,9 @@ Python-Markdown 2.3 Release Notes ================================= We are pleased to release Python-Markdown 2.3 which adds one new extension, -removes an old extension, and now runs on both Python 2 and Python 3 -without running the 2to3 conversion tool. See the list of changes below for -details. +removes a few old (obsolete) extensions, and now runs on both Python 2 and +Python 3 without running the 2to3 conversion tool. See the list of changes +below for details. Python-Markdown supports Python versions 2.6, 2.7, 3.1, 3.2, and 3.3. @@ -51,6 +51,18 @@ and will likely be removed in a future version of Python-Markdown. If you would like to continue using the extension (not recomended), it is archived on [Github](https://gist.github.com/waylan/4773365). +* The "HTML Tidy" Extension has been removed and no longer ships with Python-Markdown. +If you would like to continue using the extension (not recomended), it is +archived on [Github](https://gist.github.com/waylan/5152650). Note that the +underlying library, uTidylib, is not Python 3 compatable. Instead, it is +recommended that the newer [PyTidyLib] (version 0.2.2+ for Python 3 +compatability - install from github not PyPI) be used. As the API for that +library is rather simple, it is recommended that the output of Markdown be +wrapped in a call to PyTidyLib rather than using an extension (for example: +`tidylib.tidy_fragment(markdown.markdown(source), options={...})`). + +[PyTidyLib]: http://countergram.com/open-source/pytidylib + What's New in Python-Markdown 2.3 --------------------------------- diff --git a/docs/siteindex.txt b/docs/siteindex.txt index 3844079..45fdab2 100644 --- a/docs/siteindex.txt +++ b/docs/siteindex.txt @@ -8,7 +8,9 @@ Table of Contents ================= * [Python Markdown](index.html) + * [Goals](index.html#goals) * [Features](index.html#features) + * [Differences](index.html#differences) * [Support](index.html#support) * [Installation](install.html) * [The Easy Way](install.html#the-easy-way) @@ -36,12 +38,11 @@ Table of Contents * [Footnotes](extensions/footnotes.html) * [Tables](extensions/tables.html) * [Smart Strong](extensions/smart_strong.html) + * [Admonition](extensions/admonition.html) * [CodeHilite](extensions/code_hilite.html) - * [HTML Tidy](extensions/html_tidy.html) * [HeaderId](extensions/header_id.html) * [Meta-Data](extensions/meta_data.html) * [New Line to Break](extensions/nl2br.html) - * [RSS](extensions/rss.html) * [Sane Lists](extensions/sane_lists.html) * [Table of Contents](extensions/toc.html) * [WikiLinks](extensions/wikilinks.html) diff --git a/markdown/extensions/html_tidy.py b/markdown/extensions/html_tidy.py deleted file mode 100644 index e5f060c..0000000 --- a/markdown/extensions/html_tidy.py +++ /dev/null @@ -1,71 +0,0 @@ -from __future__ import unicode_literals -""" -HTML Tidy Extension for Python-Markdown -======================================= - -Runs [HTML Tidy][] on the output of Python-Markdown using the [uTidylib][] -Python wrapper. Both libtidy and uTidylib must be installed on your system. - -Note than any Tidy [options][] can be passed in as extension configs. So, -for example, to output HTML rather than XHTML, set ``output_xhtml=0``. To -indent the output, set ``indent=auto`` and to have Tidy wrap the output in -``<html>`` and ``<body>`` tags, set ``show_body_only=0``. - -[HTML Tidy]: http://tidy.sourceforge.net/ -[uTidylib]: http://utidylib.berlios.de/ -[options]: http://tidy.sourceforge.net/docs/quickref.html - -Copyright (c)2008 [Waylan Limberg](http://achinghead.com) - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -Dependencies: -* [Python2.3+](http://python.org) -* [Markdown 2.0+](http://packages.python.org/Markdown/) -* [HTML Tidy](http://utidylib.berlios.de/) -* [uTidylib](http://utidylib.berlios.de/) - -""" - -from __future__ import absolute_import -from . import Extension -from ..postprocessors import Postprocessor -from ..util import text_type -try: - import tidy -except ImportError: - tidy = None - -class TidyExtension(Extension): - - def __init__(self, configs): - # Set defaults to match typical markdown behavior. - self.config = dict(output_xhtml=1, - show_body_only=1, - char_encoding='utf8' - ) - # Merge in user defined configs overriding any present if nessecary. - for c in configs: - self.config[c[0]] = c[1] - - def extendMarkdown(self, md, md_globals): - # Save options to markdown instance - md.tidy_options = self.config - # Add TidyProcessor to postprocessors - if tidy: - md.postprocessors['tidy'] = TidyProcessor(md) - - -class TidyProcessor(Postprocessor): - - def run(self, text): - # Pass text to Tidy. As Tidy does not accept unicode we need to encode - # it and decode its return value. - enc = self.markdown.tidy_options.get('char_encoding', 'utf8') - return text_type(tidy.parseString(text.encode(enc), - **self.markdown.tidy_options), - encoding=enc) - - -def makeExtension(configs=None): - return TidyExtension(configs=configs) |