From: Erick T. <ida...@us...> - 2007-05-15 05:42:07
|
I had a case where it would be faster to preprocess the text before it was split into lines. This simple patch copies the textPostprocessors to add textPreprocessors. Think it could be added? -e Index: markdown.py =================================================================== --- markdown.py (revision 32) +++ markdown.py (working copy) @@ -1063,6 +1063,8 @@ self.stripTopLevelTags = 1 self.docType = "" + self.textPreprocessors = [] + self.preprocessors = [ HTML_BLOCK_PREPROCESSOR, HEADER_PREPROCESSOR, LINE_PREPROCESSOR, @@ -1610,6 +1612,8 @@ self.source = removeBOM(self.source, self.encoding) + for pp in self.textPreprocessors: + self.source = pp.run(self.source) doc = self._transform() xml = doc.toxml() |