aboutsummaryrefslogtreecommitdiffstats
path: root/docs/writing_extensions.txt
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-10-20 10:11:34 -0400
committerWaylan Limberg <waylan@gmail.com>2008-10-20 10:11:34 -0400
commit952d12302ab156cc9b289c45a96d0e3f0e7766e0 (patch)
tree6642436baa2d403ffe34f0bcc33a18a859fe5eca /docs/writing_extensions.txt
parent3fc06a968ee2548254efd08d46b5a4d46ac7e3a8 (diff)
downloadmarkdown-952d12302ab156cc9b289c45a96d0e3f0e7766e0.tar.gz
markdown-952d12302ab156cc9b289c45a96d0e3f0e7766e0.tar.bz2
markdown-952d12302ab156cc9b289c45a96d0e3f0e7766e0.zip
Combined the TextPreprocessors and Preprocessors into Preprocessors. Updated extensions and docs as well.
Diffstat (limited to 'docs/writing_extensions.txt')
-rwxr-xr-xdocs/writing_extensions.txt29
1 files changed, 1 insertions, 28 deletions
diff --git a/docs/writing_extensions.txt b/docs/writing_extensions.txt
index 617b92e..9d6fa42 100755
--- a/docs/writing_extensions.txt
+++ b/docs/writing_extensions.txt
@@ -19,8 +19,6 @@ helpful as well. For example, the [[Footnotes]] extension uses most of the
features documented here.
* [Preprocessors][]
- * [TextPreprocessors][]
- * [Line Preprocessors][]
* [InlinePatterns][]
* [Treeprocessors][]
* [Postprocessors][]
@@ -39,30 +37,7 @@ Preprocessors munge the source text before it is passed into the Markdown
core. This is an excellent place to clean up bad syntax, extract things the
parser may otherwise choke on and perhaps even store it for later retrieval.
-There are two types of preprocessors: [TextPreprocessors][] and
-[Line Preprocessors][].
-
-<h4 id="textpreprocessors">TextPreprocessors</h4>
-
-TextPreprocessors should inherit from ``markdown.TextPreprocessor`` and
-implement a ``run`` method with one argument ``text``. The ``run`` method of
-each TextPreprocessor will be passed the entire source text as a single Unicode
-string and should either return that single Unicode string, or an altered
-version of it.
-
-For example, a simple TextPreprocessor that normalizes newlines [^1] might look
-like this:
-
- class NormalizePreprocessor(markdown.TextPreprocessor):
- def run(self, text):
- return text.replace("\r\n", "\n").replace("\r", "\n")
-
-[^1]: It should be noted that Markdown already normalizes newlines. This
-example is for illustrative purposes only.
-
-<h4 id="linepreprocessors">Line Preprocessors</h4>
-
-Line Preprocessors should inherit from ``markdown.Preprocessor`` and implement
+Preprocessors should inherit from ``markdown.Preprocessor`` and implement
a ``run`` method with one argument ``lines``. The ``run`` method of each Line
Preprocessor will be passed the entire source text as a list of Unicode strings.
Each string will contain one line of text. The ``run`` method should return
@@ -457,8 +432,6 @@ This is useful if you need to implement a large number of extensions with more
than one residing in a module.
[Preprocessors]: #preprocessors
-[TextPreprocessors]: #textpreprocessors
-[Line Preprocessors]: #linepreprocessors
[InlinePatterns]: #inlinepatterns
[Treeprocessors]: #treeprocessors
[Postprocessors]: #postprocessors