diff options
author | James Moger <james.moger@gitblit.com> | 2014-05-22 17:31:30 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-05-22 17:31:30 -0400 |
commit | fd8cea4761b5382f23d06ed52608d1f556c4dbe5 (patch) | |
tree | 3ebf3c7cd8526a2e8353015a6ad94e1e8c214b70 /src/main/java/com/gitblit/utils/MarkdownUtils.java | |
parent | d07b16755045eeb28f3802e610c67325481ad5bf (diff) | |
download | gitblit-fd8cea4761b5382f23d06ed52608d1f556c4dbe5.tar.gz gitblit-fd8cea4761b5382f23d06ed52608d1f556c4dbe5.zip |
Render GFM links using Markdown, not direct HTML
Diffstat (limited to 'src/main/java/com/gitblit/utils/MarkdownUtils.java')
-rw-r--r-- | src/main/java/com/gitblit/utils/MarkdownUtils.java | 4 |
1 files 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(" **<a href=\"%1s/user/$1\">@$1</a>**", 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(" <a class='commit' href='%1$s/commit?r=%2$s&h=$1$2'>$1</a>", 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);
|