showdown icon indicating copy to clipboard operation
showdown copied to clipboard

Trailing parenthesis is still included in URL, with `excludeTrailingPunctuationFromURLs` set

Open jeradrose opened this issue 4 years ago • 2 comments

On 1.9.1, the following code:

import * as showdown from "showdown";

const showdownConverter = new showdown.Converter({
  excludeTrailingPunctuationFromURLs: true,
  simplifiedAutoLink: true,
});

console.log('(http://demo.showdownjs.com).');

Results in (which 404's):

<p>(<a href="http://demo.showdownjs.com)">http://demo.showdownjs.com)</a>.</p>

But I would expect:

<p>(<a href="http://demo.showdownjs.com">http://demo.showdownjs.com</a>).</p>

jeradrose avatar Aug 13 '20 23:08 jeradrose

Getting same behavior here, I'm using 1.8.6 on my project and was able to reproduce in 1.9.1.

elchinillo avatar Sep 10 '20 00:09 elchinillo

In Version 2.1.0, option excludeTrailingPunctuationFromURLs seems to have been removed. Instead, a "parenthesis balance" check is included in the simplifiedAutoLink subparser (https://github.com/showdownjs/showdown/blob/master/src/subParsers/makehtml/links.js#L363), but it does not seem to work.

jmandreoli avatar Jun 20 '22 18:06 jmandreoli