diff --git a/src/markup/engine/__tests__/remarkup/percent-block-solo.txt b/src/markup/engine/__tests__/remarkup/percent-block-solo.txt new file mode 100644 --- /dev/null +++ b/src/markup/engine/__tests__/remarkup/percent-block-solo.txt @@ -0,0 +1,8 @@ +%%% +**x**%%% +~~~~~~~~~~ +

+
**x**

+~~~~~~~~~~ + +**x** diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php --- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php +++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php @@ -26,6 +26,13 @@ while (preg_match('/^\s*%%%/', $lines[$cursor])) { $num_lines++; + // If the line has ONLY "%%%", the block opener doesn't get to double + // up as a block terminator. + if (preg_match('/^\s*%%%\s*\z/', $lines[$cursor])) { + $num_lines++; + $cursor++; + } + while (isset($lines[$cursor])) { if (!preg_match('/%%%\s*$/', $lines[$cursor])) { $num_lines++;