diff --git a/src/applications/project/remarkup/ProjectRemarkupRule.php b/src/applications/project/remarkup/ProjectRemarkupRule.php index 2f93a88e95..ca11a7ea8c 100644 --- a/src/applications/project/remarkup/ProjectRemarkupRule.php +++ b/src/applications/project/remarkup/ProjectRemarkupRule.php @@ -30,7 +30,7 @@ final class ProjectRemarkupRule extends PhabricatorObjectRemarkupRule { // In other contexts, the PhabricatorProjectProjectPHIDType pattern is // controlling and these names should parse correctly. - return '[^\s.\d!,:;{}#]+(?:[^\s!,:;{}#][^\s.!,:;{}#]+)*'; + return '[^\s.\d!,:;{}#\(\)]+(?:[^\s!,:;{}#\(\)][^\s.!,:;{}#\(\)]+)*'; } protected function loadObjects(array $ids) { diff --git a/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php b/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php index 4e72514b26..4efc98a5b8 100644 --- a/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php +++ b/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php @@ -45,6 +45,31 @@ final class ProjectRemarkupRuleTestCase extends PhabricatorTestCase { ), ), ), + + // Don't match a terminal parenthesis. This fixes these constructs in + // natural language. + 'There is some documentation (see #guides).' => array( + 'embed' => array(), + 'ref' => array( + array( + 'offset' => 34, + 'id' => 'guides', + ), + ), + ), + + // Don't match internal parentheses either. This makes the terminal + // parenthesis behavior less arbitrary (otherwise, we match open + // parentheses but not closing parentheses, which is surprising). + '#a(b)c' => array( + 'embed' => array(), + 'ref' => array( + array( + 'offset' => 1, + 'id' => 'a', + ), + ), + ), ); foreach ($cases as $input => $expect) {