Ensure that links containing )) still render and work correctly

AI-generated summary

The issue involves Discourse failing to render and function correctly for links containing double close parentheses )), whether pasted directly or used to create automatic text links. lindsey outlines steps to reproduce, showing that the URL gets truncated at )). Workarounds include URL encoding (%29) or wrapping the link in angle brackets (<>). j.jaffeux notes this stems from markdown-it’s underlying linkify library, which has an unresolved issue dating back over 8 years linkify-it#23. sam asks whether to fork linkify to fix it or wait for upstream, and even suggests contracting Vitaly for a fix. The category is Bug, and the tag pr-welcome indicates community contributions are welcome.

:information_source: Overview

Discourse does not properly render links when they contain double close parentheses — )) — which means these links don’t work properly when added directly or when pasted over text to create an automatic text link.

:walking_woman: Steps to reproduce

  1. Create a link that contains )) somewhere in the middle of the URL. For example, meta.discourse.org/?parameter_one=((value))&parameter_two=value.
  2. Paste this into the composer, as-is.
  3. Paste the same URL over text to create an automatic text link.

:white_check_mark: Expected results

The original link should render and function correctly in both cases.

:x: Observed results

The link functionality cuts off at the )) and the rest of the URL is dropped.

Examples:

:books: Additional context

When pasting a link directly, encoding the double close parentheses as %29) may work, as well as encapsulating the URL in <> when pasting over text. Examples:

4 Likes

I don’t think we can fix this @lindsey this is a behavior in markdown-it, and more exactly in the underlying linkify library.

You can test this behavior here: linkify-it demo

Themselves have an open issue for more than 8 years on the subject: Better handle nested parens · Issue #23 · markdown-it/linkify-it · GitHub

4 Likes

@Vitaly thoughts? Should we be forking linkify to fix this or wait for upstream? Can we contract you to fix this issue?