diff --git a/src/markup/engine/__tests__/remarkup/highlight.txt b/src/markup/engine/__tests__/remarkup/highlight.txt --- a/src/markup/engine/__tests__/remarkup/highlight.txt +++ b/src/markup/engine/__tests__/remarkup/highlight.txt @@ -1,7 +1,9 @@ how about we !!highlight!! some !!TEXT!!! wow this must be **!!very important!!** +omg!!!!! ~~~~~~~~~~

how about we highlight some TEXT! -wow this must be very important

+wow this must be very important +omg!!!!!

~~~~~~~~~~ -how about we !!highlight!! some !!TEXT!!! wow this must be **!!very important!!** +how about we !!highlight!! some !!TEXT!!! wow this must be **!!very important!!** omg!!!!! diff --git a/src/markup/engine/remarkup/markuprule/PhutilRemarkupHighlightRule.php b/src/markup/engine/remarkup/markuprule/PhutilRemarkupHighlightRule.php --- a/src/markup/engine/remarkup/markuprule/PhutilRemarkupHighlightRule.php +++ b/src/markup/engine/remarkup/markuprule/PhutilRemarkupHighlightRule.php @@ -21,6 +21,13 @@ // Remove the two exclamation points that represent syntax. $excitement = substr($matches[2], 2); + // If the internal content consists of ONLY exclamation points, leave it + // untouched so "!!!!!" is five exclamation points instead of one + // highlighted exclamation point. + if (preg_match('/^!+\z/', $matches[1])) { + return $matches[0]; + } + // $excitement now has two fewer !'s than we started with. return hsprintf('%s%s', $matches[1], $excitement);