From fd8cea4761b5382f23d06ed52608d1f556c4dbe5 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 22 May 2014 17:31:30 -0400 Subject: [PATCH] Render GFM links using Markdown, not direct HTML --- src/main/java/com/gitblit/utils/MarkdownUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.39.5