From: James Moger Date: Thu, 22 May 2014 21:31:30 +0000 (-0400) Subject: Render GFM links using Markdown, not direct HTML X-Git-Tag: v1.6.0~60 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd8cea4761b5382f23d06ed52608d1f556c4dbe5;p=gitblit.git Render GFM links using Markdown, not direct HTML --- diff --git a/src/main/java/com/gitblit/utils/MarkdownUtils.java b/src/main/java/com/gitblit/utils/MarkdownUtils.java index da0db79d..2ebfdb26 100644 --- a/src/main/java/com/gitblit/utils/MarkdownUtils.java +++ b/src/main/java/com/gitblit/utils/MarkdownUtils.java @@ -136,7 +136,7 @@ public class MarkdownUtils { String canonicalUrl = settings.getString(Keys.web.canonicalUrl, "https://localhost:8443"); // emphasize and link mentions - String mentionReplacement = String.format(" **@$1**", canonicalUrl); + String mentionReplacement = String.format(" **[@$1](%1s/user/$1)**", canonicalUrl); text = text.replaceAll("\\s@([A-Za-z0-9-_]+)", mentionReplacement); // link ticket refs @@ -146,7 +146,7 @@ public class MarkdownUtils { // link commit shas int shaLen = settings.getInteger(Keys.web.shortCommitIdLength, 6); String commitPattern = MessageFormat.format("\\s([A-Fa-f0-9]'{'{0}'}')([A-Fa-f0-9]'{'{1}'}')", shaLen, 40 - shaLen); - String commitReplacement = String.format(" $1", canonicalUrl, repositoryName); + String commitReplacement = String.format(" [`$1`](%1$s/commit?r=%2$s&h=$1$2)", canonicalUrl, repositoryName); text = text.replaceAll(commitPattern, commitReplacement); String html = transformMarkdown(text);