1
0
Fork 0

links to other issues

This commit is contained in:
Lukas Winkler 2017-09-23 13:12:58 +02:00
parent 34f2376458
commit 93b41b2a58

View file

@ -20,6 +20,7 @@ class Markdown extends \Parsedown
*/ */
public function text($markdown) { public function text($markdown) {
$markdown = $this->parseMentions($markdown); $markdown = $this->parseMentions($markdown);
$markdown = $this->parseIssueMentions($markdown);
$this->setBreaksEnabled(true); $this->setBreaksEnabled(true);
$html = parent::text($markdown); $html = parent::text($markdown);
@ -32,6 +33,12 @@ class Markdown extends \Parsedown
return preg_replace($regex, "<a class='mention' href='https://github.com/$1'>$0</a>", $markdown); return preg_replace($regex, "<a class='mention' href='https://github.com/$1'>$0</a>", $markdown);
} }
private function parseIssueMentions($markdown) {
$regex = '/#(\d+)/';
return preg_replace($regex, "<a href='/$1'>$0</a>", $markdown);
}
/** /**
* <a href="http://issues.piwik.org/attachments/1199/swelen_dateslider.swf">swelen_dateslider.swf</a> * <a href="http://issues.piwik.org/attachments/1199/swelen_dateslider.swf">swelen_dateslider.swf</a>
* to * to