]> source.dussan.org Git - gitblit.git/commitdiff
Render GFM links using Markdown, not direct HTML
authorJames Moger <james.moger@gitblit.com>
Thu, 22 May 2014 21:31:30 +0000 (17:31 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 22 May 2014 21:31:30 +0000 (17:31 -0400)
src/main/java/com/gitblit/utils/MarkdownUtils.java

index da0db79da9d2ae889770ef4a5fa4a0fc513c5e88..2ebfdb26463efaf6db5caeb08be20a06f174233e 100644 (file)
@@ -136,7 +136,7 @@ public class MarkdownUtils {
                String canonicalUrl = settings.getString(Keys.web.canonicalUrl, "https://localhost:8443");\r
 \r
                // emphasize and link mentions\r
-               String mentionReplacement = String.format(" **<a href=\"%1s/user/$1\">@$1</a>**", canonicalUrl);\r
+               String mentionReplacement = String.format(" **[@$1](%1s/user/$1)**", canonicalUrl);\r
                text = text.replaceAll("\\s@([A-Za-z0-9-_]+)", mentionReplacement);\r
 \r
                // link ticket refs
@@ -146,7 +146,7 @@ public class MarkdownUtils {
                // link commit shas\r
                int shaLen = settings.getInteger(Keys.web.shortCommitIdLength, 6);\r
                String commitPattern = MessageFormat.format("\\s([A-Fa-f0-9]'{'{0}'}')([A-Fa-f0-9]'{'{1}'}')", shaLen, 40 - shaLen);\r
-               String commitReplacement = String.format(" <a class='commit' href='%1$s/commit?r=%2$s&h=$1$2'>$1</a>", canonicalUrl, repositoryName);\r
+               String commitReplacement = String.format(" [`$1`](%1$s/commit?r=%2$s&h=$1$2)", canonicalUrl, repositoryName);\r
                text = text.replaceAll(commitPattern, commitReplacement);\r
 \r
                String html = transformMarkdown(text);\r