Permalink
Browse files

Wire in a preprocess method as well for subclasses.

  • Loading branch information...
1 parent d2326c3 commit 8147090db67872a91300f5721aeb97b38fdbdd00 @joestump joestump committed Jun 14, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/markdown2.py
View
@@ -300,6 +300,8 @@ def convert(self, text):
if "metadata" in self.extras:
text = self._extract_metadata(text)
+ text = self.preprocess(text)
+
if self.safe_mode:
text = self._hash_html_spans(text)
@@ -342,6 +344,13 @@ def postprocess(self, text):
"""
return text
+ def preprocess(self, text):
+ """A hook for subclasses to do some preprocessing of the Markdown, if
+ desired. This is called after basic formatting of the text, but prior
+ to any extras, safe mode, etc. processing.
+ """
+ return text
+
# Is metadata if the content starts with '---'-fenced `key: value`
# pairs. E.g. (indented for presentation):
# ---

0 comments on commit 8147090

Please sign in to comment.