diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php index ea7270dae2..aa31911cfd 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php @@ -15,19 +15,23 @@ final class PhabricatorRemarkupRulePhriction public function markupDocumentLink($matches) { - $slug = trim($matches[1]); - $name = trim(idx($matches, 2, $slug)); + $link = trim($matches[1]); + $name = trim(idx($matches, 2, $link)); $name = explode('/', trim($name, '/')); $name = end($name); - $slug = PhabricatorSlug::normalize($slug); - $uri = PhrictionDocument::getSlugURI($slug); + $uri = new PhutilURI($link); + $slug = $uri->getPath(); + $fragment = $uri->getFragment(); + $slug = PhabricatorSlug::normalize($slug); + $slug = PhrictionDocument::getSlugURI($slug); + $href = (string) id(new PhutilURI($slug))->setFragment($fragment); return $this->getEngine()->storeText( phutil_render_tag( 'a', array( - 'href' => $uri, + 'href' => $href, 'class' => 'phriction-link', ), phutil_escape_html($name)));