Notebook: Markdown inline links break when ) in the url, reference style links do not

Created on 30 Jul 2017  路  2Comments  路  Source: jupyter/notebook

Hallo,
When there is a closing parenthesis in the URL and one wants to use markdown's inline link style the link breaks.

[Link](https://example.com/?test=this(fails)here)

produces a link that ends before the "here)".
In contrast to this behaviour the reference style links work as expected:

[Link][1]

[1]: https://example.com/?test=this(does)not_fail

produces a link that goes to the expected destination.

I created a minimal working example that has both the Notebook as well as the HTML export, if you cannot reproduce the behaviour I have got.

The About page says:

You are using Jupyter notebook.
The version of the notebook server is 5.0.0 and is running on:
Python 3.6.2 (default, Jul 19 2017, 13:09:21) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
Current Kernel Information:
Python 3.6.2 (default, Jul 19 2017, 13:09:21) Type 'copyright', 'credits' or 'license' for more information IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

PS:
Markdown renders it correctly and this GitHub-comment does so, too.

Most helpful comment

Ok, I didn't knew that Jupyter uses marked.

marked already has an open issue on this from 2015.

In their discussion the provided workaround is to "replace closing parentheses with %29"

All 2 comments

I think that this is a bug in marked, the JS markdown renderer we use. It looks like it also affects mistune, a Python renderer used in nbconvert.

According to the CommonMark spec, one level of balanced parentheses is allowed in the link destination - but not arbitrary nesting, which can't be matched with a regex.

[link]((foo)and(bar))

Ok, I didn't knew that Jupyter uses marked.

marked already has an open issue on this from 2015.

In their discussion the provided workaround is to "replace closing parentheses with %29"

Was this page helpful?
0 / 5 - 0 ratings