Commit f13c4464 authored by Robert Knight's avatar Robert Knight

Automatically convert URLs in annotation text to links

Only URLs with a scheme or beginning with 'www.' are processed.

Fixes #2505
parent adf772d8
......@@ -8,6 +8,10 @@ function targetBlank(converter) {
}
module.exports = function () {
var converter = new showdown.Converter({extensions: [targetBlank]});
// see https://github.com/showdownjs/showdown#valid-options
var converter = new showdown.Converter({
extensions: [targetBlank],
simplifiedAutoLink: true
});
return converter.makeHtml.bind(converter);
};
var converter = require('../converter');
describe('markdown converter', function () {
var markdownToHTML = converter();
it('should autolink URLs', function () {
assert.equal(markdownToHTML('See this link - http://arxiv.org/article'),
'<p>See this link - <a target="_blank" href="http://arxiv.org/article">' +
'http://arxiv.org/article</a></p>');
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment