# Reference links followed by space-only pair of brackets

**URL:** <https://talk.commonmark.org/t/reference-links-followed-by-space-only-pair-of-brackets/4581>\
**Category:** Spec\
**Created:** [January 15, 2024, 8:09pm UTC](https://talk.commonmark.org/t/reference-links-followed-by-space-only-pair-of-brackets/4581 "2024-01-15T20:09:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![notriddle](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/notriddle/32/1237_2.png) [@notriddle](https://talk.commonmark.org/u/notriddle)\
**Post date:** [January 15, 2024, 8:09pm UTC](https://talk.commonmark.org/t/reference-links-followed-by-space-only-pair-of-brackets/4581/1 "2024-01-15T20:09:55Z")

</div>

Consider this example:

```markdown
[foo]: https://example.com

[foo][
]

```

Or, equivalently, this one:

```markdown
[foo]: https://example.com

[foo][]

```

It seems ambiguous from the commonmark spec whether there’s a link here or not

- commonmark-hs, commonmark-js, and markdown-it all say that there isn’t a link. They render: [foo][]
- pulldown-cmark and goldmark both say that there is. They render: [foo](https://example.com)[]

I’m pretty sure the reference implementation justifies this choice by [example 570](https://spec.commonmark.org/0.30/#example-570), which is annotated like this:

> Here `[foo]` is not parsed as a shortcut reference, because it is followed by a link label (even though `[bar]` is not defined):
> 
> ```markdown
> [foo][bar][baz]
> 
> [baz]: /url1
> [foo]: /url2
> 
> ```

However, `[]` cannot actually be a valid label, because it contains only whitespace.

Interestingly enough, the rule is definitely not “collapsed links can’t be followed by `[`.” If I drop the last line, making it like this, I get a link:

```markdown
[foo]: https://example.com

[foo][

```
