diff options
author | Waylan Limberg <waylan@gmail.com> | 2008-10-19 23:22:05 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2008-10-19 23:22:05 -0400 |
commit | 53f95cde694975e556db7569d3bd89f84459e7bb (patch) | |
tree | ebc2fe47208170c20be63d690fc5a19364f8f7e1 /docs/writing_extensions.txt | |
parent | 15224bd352bc6c06ae05ffd78d5ecee9ea07f6ef (diff) | |
download | markdown-53f95cde694975e556db7569d3bd89f84459e7bb.tar.gz markdown-53f95cde694975e556db7569d3bd89f84459e7bb.tar.bz2 markdown-53f95cde694975e556db7569d3bd89f84459e7bb.zip |
Made InlineProcessor a TreeProcessor. Now an extension can manipulate the tree either before or after InlinePatterns are run. Updated docs as well. This change should not affect existing extensions.
Diffstat (limited to 'docs/writing_extensions.txt')
-rwxr-xr-x | docs/writing_extensions.txt | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/docs/writing_extensions.txt b/docs/writing_extensions.txt index a97dfdb..617b92e 100755 --- a/docs/writing_extensions.txt +++ b/docs/writing_extensions.txt @@ -22,8 +22,8 @@ features documented here. * [TextPreprocessors][] * [Line Preprocessors][] * [InlinePatterns][] -* [Treeprocessors][] -* [Prostprocessors][] +* [Treeprocessors][] +* [Postprocessors][] * [MarkdownParser][] * [Working with the ElementTree][] * [Integrating your code into Markdown][] @@ -147,17 +147,13 @@ or use as well. Read through the source and see if there is anything you can use. You might even get a few ideas for different approaches to your specific situation. -<h3 id="postprocessors">Postprocessors</h3> - -Postprocessors manipulate a document after it has passed through the Markdown -core. This is were stored text gets added back in; such as a list of footnotes, -a table of contents, or raw html. - -There are two types of postprocessors: [ElementTree Postprocessors][] and -[TextPostprocessors][]. - <h3 id="treeprocessors">Treeprocessors</h3> +Treeprocessors manipulate an ElemenTree object after it has passed through the +core MarkdownParser. This is where additional manipulation of the tree takes +place. Additionaly, the InlineProcessor is a Treeprocessor which steps through +the tree and runs the InlinePatterns on the text of each Element in the tree. + An Treeprocessor should inherit from ``markdown.Treeprocessor``, over-ride the ``run`` method which takes one argument ``root`` (an Elementree object) and returns either that root element or a modified root element. @@ -174,6 +170,10 @@ For specifics on manipulating the ElementTree, see <h3 id="postprocessors">Postprocessors</h3> +Postprocessors manipulate the document after the ElementTree has been +serialized into a string. Postprocessors should be used to work with the +text just before output. + A Postprocessor should inherit from ``markdown.Postprocessor`` and over-ride the ``run`` method which takes one argument ``text`` and returns a Unicode string. @@ -310,8 +310,8 @@ arguments: * ``md.textPreprocessors`` * ``md.preprocessors`` * ``md.inlinePatterns`` - * ``md.postpreprocessors`` - * ``md.textPostprocessors`` + * ``md.treepreprocessors`` + * ``md.postprocessors`` Some other things you may want to access in the markdown instance are: |