# Links with parentheses in markdown

**URL:** https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667
**Category:** Help
**Created:** [June 8, 2022, 2:57pm UTC](https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667 "2022-06-08T14:57:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![floatingpurr](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/floatingpurr/32/5572_2.png) [@floatingpurr](https://talk.observablehq.com/u/floatingpurr)
#### Post date: [June 8, 2022, 2:57pm UTC](https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667/1 "2022-06-08T14:57:59Z")

</div>

Hi, I’m wondering how to render properly a link with parentheses in markdown. I can’t escape the link’s ‘`)`’

Here are some shy attempts of mine:

> **[Links with parentheses in markdown](https://observablehq.com/d/5ed9ccda197ca32a)**
>
> My broken link My still broken link(fooo\_(bar\\))

---

<div class="post-metadata">

### Author: ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)
#### Post date: [June 8, 2022, 3:04pm UTC](https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667/2 "2022-06-08T15:04:37Z")

</div>

`(` is %28 and `)` is %29:

`My [working link](https://en.wikipedia.org/wiki/Parenthesis_(disambiguation%29)`

---

<div class="post-metadata">

### Author: ![tophtucker](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tophtucker/32/4781_2.png) [@tophtucker](https://talk.observablehq.com/u/tophtucker)
#### Post date: [June 8, 2022, 3:28pm UTC](https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667/3 "2022-06-08T15:28:49Z")

</div>

Lol, good example link @Fil!

I also sometimes fall back on writing out the HTML. It’s not totally satisfying, but good to remember you can write HTML in Markdown!

```auto
<a href="https://en.wikipedia.org/wiki/Parenthesis_(disambiguation)">working link</a>. 

```

---

<div class="post-metadata">

### Author: ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)
#### Post date: [June 8, 2022, 3:49pm UTC](https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667/4 "2022-06-08T15:49:23Z")

</div>

To my knowledge Fil’s example is the only suitable workaround for older Markdown implementations if you don’t want to fall back to HTML.

The current CommonMark spec accounts for parentheses insofar that you can have a matching number of opening and closing parens in the URL part. Discourse uses Markdown-It which is 100% spec-compliant, so [this dummy link](https://example.com/()()()(())) is parsed correctly.

Unfortunately Observable still includes [a legacy version of Marked](https://github.com/observablehq/stdlib/blob/40354021cf6bb7e599f6f547a7c94e01046405c2/src/dependencies.js#L11) and will continue to do so until version pinning for the Standard Library has been added (more [in this issue](https://github.com/observablehq/stdlib/issues/272#issuecomment-1148136049)).

You can compare the differences between Marked versions at [this link](https://marked.js.org/demo/?text=%5Bthis%20dummy%20link%5D(https%3A%2F%2Fexample.com%2F()()()(()))&options=%7B%0A%20%22baseUrl%22%3A%20null%2C%0A%20%22breaks%22%3A%20false%2C%0A%20%22extensions%22%3A%20null%2C%0A%20%22gfm%22%3A%20true%2C%0A%20%22headerIds%22%3A%20true%2C%0A%20%22headerPrefix%22%3A%20%22%22%2C%0A%20%22highlight%22%3A%20null%2C%0A%20%22langPrefix%22%3A%20%22language-%22%2C%0A%20%22mangle%22%3A%20true%2C%0A%20%22pedantic%22%3A%20false%2C%0A%20%22sanitize%22%3A%20false%2C%0A%20%22sanitizer%22%3A%20null%2C%0A%20%22silent%22%3A%20false%2C%0A%20%22smartLists%22%3A%20false%2C%0A%20%22smartypants%22%3A%20false%2C%0A%20%22tokenizer%22%3A%20null%2C%0A%20%22walkTokens%22%3A%20null%2C%0A%20%22xhtml%22%3A%20false%0A%7D&version=0.3.12).

---

<div class="post-metadata">

### Author: ![saf-dmitry](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/saf-dmitry/32/9659_2.png) [@saf-dmitry](https://talk.observablehq.com/u/saf-dmitry)
#### Post date: [September 25, 2025, 7:22pm UTC](https://talk.observablehq.com/t/links-with-parentheses-in-markdown/6667/5 "2025-09-25T19:22:17Z")

</div>

> [@mootari](#):
>
> The current CommonMark spec accounts for parentheses insofar that you can have a matching number of opening and closing parens in the URL part.

Matching opening and closing parens not required. According to CommonMark spec, the URL part can contain `)` if it is enclosed in pointy brackets: `[a](<b)c>)`.

Actually, it have been part of Markdown syntax since the original Markdown implementation, and the vast majority of Markdown parsers interpret it correctly (but not in Observable Notebooks ☹).
