showdown
showdown copied to clipboard
Trailing parenthesis is still included in URL, with `excludeTrailingPunctuationFromURLs` set
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>
Getting same behavior here, I'm using 1.8.6 on my project and was able to reproduce in 1.9.1.
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.