diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php @@ -2,6 +2,13 @@ final class PhutilRemarkupInterpreterBlockRule extends PhutilRemarkupBlockRule { + /** + * This regex tries to find something like: + * interpreterName {{{ stuff }}} + * And, also it tries to find this alternative: + * interpreterName (options) {{{ stuff }}} + * If you are asking, yep! You have found the kernel of cowsay and figlet! + */ const START_BLOCK_PATTERN = '/^([\w]+)\s*(?:\(([^)]+)\)\s*)?{{{/'; const END_BLOCK_PATTERN = '/}}}\s*$/'; @@ -74,16 +81,21 @@ $message = pht('No interpreter found: %s', $matches[1]); + // The syntax of this thing is so recondite that, showing a message, + // it simply risks making people screaming. + // Let's just log this information, + // preferring a "don't care strategy" on rendering. + phlog($message); + + // After logging the error, just render the text as-is. if ($this->getEngine()->isTextMode()) { - return '('.$message.')'; + return $text; } - return phutil_tag( - 'div', - array( - 'class' => 'remarkup-interpreter-error', - ), - $message); - } + if ($this->getEngine()->getConfig('preserve-linebreaks')) { + $text = phutil_escape_html_newlines($text); + } + return $text; + } }