Updated HTML block parser to correctly find the end of a fenced code block.

This commit is contained in:
Michel Fortin 2013-01-06 16:56:42 -05:00
parent 2b19a639a3
commit 6ebb841e7d

View file

@ -2036,10 +2036,10 @@ class MarkdownExtra_Parser extends Markdown_Parser {
#
# Check for: Fenced code block marker.
#
else if (preg_match('{^\n?[ ]{0,'.($indent+3).'}~}', $tag)) {
else if (preg_match('{^\n?[ ]{0,'.($indent+3).'}(~+)}', $tag, $capture)) {
# Fenced code block marker: find matching end marker.
$tag_re = preg_quote(trim($tag));
if (preg_match('{^(?>.*\n)+?[ ]{0,'.($indent).'}'.$tag_re.'[ ]*\n}', $text,
$fence_re = $capture[1]; # use captured fence in re
if (preg_match('{^(?>.*\n)+?[ ]{0,'.($indent).'}'.$fence_re.'[ ]*\n}', $text,
$matches))
{
# End marker found: pass text unchanged until marker.