markdown: Make raw urls in topic names navigable.

We reuse the link regexes we use elsewhere inn markdown
for parsing links in topic names and add a button to open
them in new tabs similar to our behavior with linkifiers
in topic names.

Fixes #12391.
This commit is contained in:
Rohitt Vashishtha
2019-05-25 19:40:30 +05:30
committed by Tim Abbott
parent 96d7c1f3b0
commit 047086b81c
4 changed files with 47 additions and 0 deletions

View File

@@ -160,6 +160,14 @@ exports.add_topic_links = function (message) {
links.push(link_url);
}
});
// Also make raw urls navigable
var url_re = /\b(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/g; // Slightly modified from third/marked.js
var match = topic.match(url_re);
if (match) {
links = links.concat(match);
}
util.set_topic_links(message, links);
};