Skip to content

Commit

Permalink
Markdown image tags are now supported in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
KuiKui committed Jun 15, 2012
1 parent 26a4f78 commit 26aedac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/helper/MarkdownHelper.php
Expand Up @@ -71,10 +71,6 @@ function Markdown($text) {
$parser = new $parser_class;
}

# Generate Markdwon links from urls
$pattern = "/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))/";
$text = preg_replace($pattern, '[$1]($1)', $text);

# Generate line breaks (2 spaces are no more needed)
$text = preg_replace('/\r/', '', $text);
$text = preg_replace('/\n/', " \n", $text);
Expand Down Expand Up @@ -690,6 +686,10 @@ function doAnchors($text) {
if ($this->in_anchor) return $text;
$this->in_anchor = true;

# Generate Markdwon links from urls
$pattern = "/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))/";
$text = preg_replace($pattern, '[$1]($1)', $text);

#
# First, handle reference-style links: [link text] [id]
#
Expand Down

0 comments on commit 26aedac

Please sign in to comment.