Permalink
Browse files

issue #86: Fix fenced-code-blocks not being parsed out before other s…

…yntax elements, like headers.
  • Loading branch information...
trentm committed Apr 26, 2012
1 parent 658ade1 commit 67d8663c455cc3823dfdb8411b33e83d95374873
View
@@ -2,6 +2,9 @@
## python-markdown2 1.4.1 (not yet released)
+- [issue #86, 'fenced-code-blocks' extra] Fix fenced code blocks not being
+ parsed out before other syntax elements, like headers.
+
- [issue #83, 'fenced-code-blocks' and 'code-color' extras] Allow 'cssclass'
code coloring option (passed to pygments) to be overridden (by
https://github.com/kaishaku). E.g.:
View
@@ -766,6 +766,9 @@ def _run_block_gamut(self, text):
# These are all the transformations that form block-level
# tags like paragraphs, headers, and list items.
+ if "fenced-code-blocks" in self.extras:
+ text = self._do_fenced_code_blocks(text)
+
text = self._do_headers(text)
# Do Horizontal Rules:
@@ -788,8 +791,6 @@ def _run_block_gamut(self, text):
text = self._prepare_pyshell_blocks(text)
if "wiki-tables" in self.extras:
text = self._do_wiki_tables(text)
- if "fenced-code-blocks" in self.extras:
- text = self._do_fenced_code_blocks(text)
text = self._do_code_blocks(text)
@@ -1524,7 +1525,6 @@ def _do_fenced_code_blocks(self, text):
^```[ \t]*\n # closing fence
''', re.M | re.X | re.S)
- #print "XXX", fenced_code_block_re.findall(text)
return fenced_code_block_re.sub(self._fenced_code_block_sub, text)
# Rules for a code span:
@@ -0,0 +1,4 @@
+<pre><code># this should not be a heading
+
+print "hi"
+</code></pre>
@@ -0,0 +1 @@
+{"extras": ["fenced-code-blocks"]}
@@ -0,0 +1 @@
+extra fenced-code-blocks issue86
@@ -0,0 +1,5 @@
+```
+# this should not be a heading
+
+print "hi"
+```

0 comments on commit 67d8663

Please sign in to comment.