diff --git a/PHP Markdown Extra Readme.text b/PHP Markdown Extra Readme.text index 06212d9..f65b323 100644 --- a/PHP Markdown Extra Readme.text +++ b/PHP Markdown Extra Readme.text @@ -216,6 +216,9 @@ Latest Extra: * Fixed an issue preventing fenced code blocks indented inside lists items and elsewhere from being interpreted correctly. +* Fixed an issue where HTML tags inside fenced code blocks were sometime + not encoded with entities. + 1.0.1n (10 Oct 2009): diff --git a/markdown.php b/markdown.php index a908922..6962eae 100644 --- a/markdown.php +++ b/markdown.php @@ -1947,17 +1947,9 @@ class MarkdownExtra_Parser extends Markdown_Parser { } } # - # Check for: Indented code block. - # - else if ($tag{0} == "\n" || $tag{0} == " ") { - # Indented code block: pass it unchanged, will be handled - # later. - $parsed .= $tag; - } - # # Check for: Fenced code block marker. # - else if ($tag{0} == "~") { + else if (preg_match('{^\n?[ ]{0,'.($indent+3).'}~}', $tag)) { # Fenced code block marker: find matching end marker. $tag_re = preg_quote(trim($tag)); if (preg_match('{^(?>.*\n)+?[ ]{0,'.($indent).'}'.$tag_re.'[ ]*\n}', $text, @@ -1973,6 +1965,14 @@ class MarkdownExtra_Parser extends Markdown_Parser { } } # + # Check for: Indented code block. + # + else if ($tag{0} == "\n" || $tag{0} == " ") { + # Indented code block: pass it unchanged, will be handled + # later. + $parsed .= $tag; + } + # # Check for: Opening Block level tag or # Opening Context Block tag (like ins and del) # used as a block tag (tag is alone on it's line).