Commit c91d4552 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Explicitly set excludeTrailingPunctuationFromURLs to true in showdown config

parent 67b517fb
......@@ -31,6 +31,7 @@ function renderMarkdown(markdown) {
converter = new showdown.Converter({
extensions: [targetBlank],
simplifiedAutoLink: true,
excludeTrailingPunctuationFromURLs: true,
// Since we're using simplifiedAutoLink we also use
// literalMidWordUnderscores because otherwise _'s in URLs get
// transformed into <em>'s.
......
......@@ -45,6 +45,16 @@ describe('render-markdown', () => {
'https://hypothes.is/stream?q=tag:group_test_needs_card</a></p>'
);
});
['.', ',', '!', '?'].forEach(symbol => {
it('should autolink URLs excluding trailing punctuation symbols', () => {
assert.equal(
render(`See this link - http://arxiv.org/article${symbol}`),
'<p>See this link - <a href="http://arxiv.org/article" target="_blank">' +
`http://arxiv.org/article</a>${symbol}</p>`
);
});
});
});
describe('markdown rendering', () => {
......
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