Join us on the Linux Gaming community on Lemmy, the federated open source alternative to Reddit.
Markdown URLs consume all close parentheses [FIXED]
WorMzy 16 Apr
This url markdown has four close parentheses after it))))

This url markdown does not

It seems these trailing parentheses also break the hyperlink (both the above should direct to the Gaming on Linux homepage). Quoting this post may explain things better, otherwise this image captures what I mean: https://imgur.com/a/hlsLVez

This behaviour can be worked around by inserting a space between the close parentheses and those trailing, but it seems the regex involved with URL parsing is too greedy (assuming regex is involved)

Last edited by Liam Dawe on 17 April 2021 at 10:46 am UTC
This topic has an answer marked - jump to answer.
Liam Dawe 17 Apr
Hi, thanks for the report, looks like I managed to solve it.
WorMzy 20 Apr
It seems this change breaks URLs that legitimately have close parentheses in them. i.e.
Wikipaedia - Conda (package manager))

Looks like some other markdown-capable sites have wrestled with this, and some have implemented fancy regex to ignore matched parentheses and others have settled for users escaping close parentheses or percent-encoding the parentheses (the former is not currently supported here).

My suggestion would be to support optional URL quoting, i.e.
 
[Wikipaedia - Conda (package manager)]("https://en.wikipedia.org/wiki/Conda_(package_manager)")

So everything between (" and ") is used as-is, parentheses and all. Not sure how easy that would be to implement though.
Liam Dawe 20 Apr
The REGEX has been upgraded once again, this time to allow quotes within the brackets to allow matching as suggested. FYI though, percent-encoding the parentheses did work before:

 
 [Wikipaedia - Conda (package manager)]("https://en.wikipedia.org/wiki/Conda_(package_manager)")

Wikipaedia - Conda (package manager)

 [Wikipaedia - Conda (package manager)](https://en.wikipedia.org/wiki/Conda_(package_manager%29)
Wikipaedia - Conda (package manager)
WorMzy 20 Apr
Great work! :D

I meant the escaping doesn't work, i.e.
[Wikipaedia - Conda (package manager)](https://en.wikipedia.org/wiki/Conda_(package_manager\))

Wikipaedia - Conda (package manager))

Not an issue now, of course. :)
While you're here, please consider supporting GamingOnLinux on:

Patreon, Liberapay or PayPal Donation.

This ensures all of our main content remains totally free for everyone with no article paywalls. We also don't have tons of adverts, there's also no tracking and we respect your privacy. Just good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register

Or login with...
Sign in with Steam Sign in with Twitter Sign in with Google
Social logins require cookies to stay logged in.