diff --git a/app/assets/javascripts/discourse/lib/markdown.js b/app/assets/javascripts/discourse/lib/markdown.js index 00748dfae1c..7d408619517 100644 --- a/app/assets/javascripts/discourse/lib/markdown.js +++ b/app/assets/javascripts/discourse/lib/markdown.js @@ -134,6 +134,10 @@ Discourse.Markdown = { if(/^(https?:)?\/\/[\w\.\-]+/i.test(url)) { return url; } // relative urls if(/^\/[\w\.\-]+/i.test(url)) { return url; } + // anchors + if(/^#[\w\.\-]+/i.test(url)) { return url; } + // mailtos + if(/^mailto:[\w\.\-@]+/i.test(url)) { return url; } }, /** diff --git a/test/javascripts/mdtest/fixtures/Links, reference style.text b/test/javascripts/mdtest/fixtures/Links, reference style.text index 341ec88e3d0..96d4470d10b 100755 --- a/test/javascripts/mdtest/fixtures/Links, reference style.text +++ b/test/javascripts/mdtest/fixtures/Links, reference style.text @@ -56,7 +56,7 @@ In this case, [this](/somethingelse/) points to something else. Backslashing should suppress \[this] and [this\]. -[this]: foo +[this]: #foo * * * diff --git a/test/javascripts/mdtest/fixtures/Links, reference style.xhtml b/test/javascripts/mdtest/fixtures/Links, reference style.xhtml index 8e70c32f4d4..9eb8ffe694c 100755 --- a/test/javascripts/mdtest/fixtures/Links, reference style.xhtml +++ b/test/javascripts/mdtest/fixtures/Links, reference style.xhtml @@ -19,15 +19,15 @@
-

this should work

+

this should work

-

So should this.

+

So should this.

-

And this.

+

And this.

-

And this.

+

And this.

-

And this.

+

And this.

But not [that] [].

@@ -35,9 +35,9 @@

Nor [that].

-

[Something in brackets like this should work]

+

[Something in brackets like this should work]

-

[Same with this.]

+

[Same with this.]

In this case, this points to something else.