diff options
Diffstat (limited to 'sonar-markdown/src')
-rw-r--r-- | sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java | 2 | ||||
-rw-r--r-- | sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java index 2158c428f00..5a8522399ea 100644 --- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java +++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java @@ -33,6 +33,6 @@ class HtmlUrlChannel extends RegexChannel<MarkdownOutput> { @Override protected void consume(CharSequence token, MarkdownOutput output) { - output.append("<a href=\"" + token + "\">" + token + "</a>"); + output.append("<a href=\"" + token + "\" target=\"_blank\">" + token + "</a>"); } } diff --git a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java index 123c64c9360..b1979254828 100644 --- a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java +++ b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java @@ -28,17 +28,19 @@ public class MarkdownEngineTest { @Test public void shouldDecorateUrl() { - assertThat(MarkdownEngine.convertToHtml("http://google.com"), is("<a href=\"http://google.com\">http://google.com</a>")); + assertThat(MarkdownEngine.convertToHtml("http://google.com"), + is("<a href=\"http://google.com\" target=\"_blank\">http://google.com</a>")); } @Test public void shouldDecorateEndOfLine() { assertThat(MarkdownEngine.convertToHtml("1\r2\r\n3\n"), is("1<br/>2<br/>3<br/>")); } - + @Test public void shouldDecorateList() { - assertThat(MarkdownEngine.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), is("<ul><li>one</li>\r<li>two</li>\r\n<li>three</li>\n<li> </li>\n</ul> *five")); + assertThat(MarkdownEngine.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), + is("<ul><li>one</li>\r<li>two</li>\r\n<li>three</li>\n<li> </li>\n</ul> *five")); assertThat(MarkdownEngine.convertToHtml(" * one\r* two"), is("<ul><li>one</li>\r<li>two</li></ul>")); } |