Showdown: simplifiedAutoLink URLs inside parenthesis followed by another character are not parsed correctly

Created on 9 Mar 2017  Â·  4Comments  Â·  Source: showdownjs/showdown

Hi again :)

When a user enters an URL inside of parenthesis and follows that with a character, the html is incorrect (with excludeTrailingPunctuationFromURLs = true). For example, if you enter Some text… (see http://example.com). the html output is

<p>Some text… (see <a href="http://example.com)">http://example.com)</a>.</p>

The expected output is

<p>Some text… (see <a href="http://example.com">http://example.com</a>).</p>

Thanks and also thanks for resolving the last issue so quickly!

bug pending

Most helpful comment

Should be fixed now.

@jendewalt @rugk Can you test please? Let me know if it worked for you.


Donate Click here to lend your support to: ShowdownJS website and testing platform and make a donation at paypal.com

As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money.
If you like our work and find our library useful, please donate through Pledgie or directly through paypal!! Your contribution will be greatly appreciated and help us continue to develop this awesome library.

All 4 comments

well, this is a hard one to tackle.
Because this is a valid address http://example.com/foo), albeit strange.

The only way to know whether the trailing parenthesis belongs to the URL or not is by context.

So I will need to think about this issue for a bit.

Minor update: The issue is not forgotten, but I haven't figure out an efficient way of doing this...

I have a partial fix: It trims the url of punctuation marks. Example:

Cool site (see http://example.com).!?;,
<p>Cool site (see <a href="http://example.com">http://example.com</a>).!?;,</p>

but it fails in this case

For a cool site see http://example.com/(cool_site).
<p>For a cool site see <a href="http://example.com">http://example.com/(cool_site</a>).</p>

In https://github.com/showdownjs/showdown/issues/560 I've described how a reasonable compromise may be done: If (is mentioned in the URL match ) at the end as "inside URL", otherwise don't.

Should be fixed now.

@jendewalt @rugk Can you test please? Let me know if it worked for you.


Donate Click here to lend your support to: ShowdownJS website and testing platform and make a donation at paypal.com

As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money.
If you like our work and find our library useful, please donate through Pledgie or directly through paypal!! Your contribution will be greatly appreciated and help us continue to develop this awesome library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oscarmorrison picture oscarmorrison  Â·  4Comments

qyvlik picture qyvlik  Â·  4Comments

subodhpareek18 picture subodhpareek18  Â·  5Comments

reisraff picture reisraff  Â·  5Comments

DesignResponds picture DesignResponds  Â·  3Comments