Crissov
January 3, 2018, 12:23am
13
Overall, this idea is seen favorable upon. Maybe, however, we should really ask a related, more general question:
Should link reference definitions completely vanish?
Mainly to support extensions (e.g. for footnotes, abbreviations, definitions/glossaries, bibliographies), I believe they should be kept at least in the AST and perhaps even invisibly in HTML output:
[foo]: foo
[bar]: <>
[baz]: "baz"
[quuz]:
.
<a id="foo" href="foo"></a>
<a id="bar" href=""></a>
<a id="baz" title="baz"></a>
<a id="quuz"></a>
The example does not address the problem of DOM clobbering mentioned before.
Related
opened 06:17PM - 27 Oct 14 UTC
closed 05:24PM - 03 Apr 19 UTC
spec
Since `<>` is a valid [link destination](http://spec.commonmark.org/0.6/#link-de… stination), a link reference should be able to have `<>` as the destination.
So I suggest to add the following test in link references:
```
.
[foo]: <>
[foo]
.
<p><a href="">foo</a></p>
.
```
May result obvious but some parsers (including the JS implementation) fail.
opened 12:56PM - 18 Dec 17 UTC
closed 08:32PM - 10 Jan 20 UTC
The spec v0.28 clearly states that [link destinations](http://spec.commonmark.or… g/0.28/#link-destination) inside angular brackets can be the empty string:
> A link destination consists of either
>
> - a sequence of zero or more characters between an opening `<` and a closing `>` that contains no spaces, line breaks, or unescaped `<` or `>` characters …
[Dingus]/Commonmark.js and cmark do not support this yet, while markdown-it does. The specified behavior may be beneficial for future extensions, e.g. footnotes or info strings for links or general inline markup.
[Dingus]: http://spec.commonmark.org/dingus/?text=%5Blink%20text%5D%5Blabel%5D%0A%0A%5Blabel%5D%3A%20<>%20"title"
When a link reference definition does not match any link reference, it is still treated as a link reference definition, but because there is no matching link reference, it will not appear in the output.
I agree that it would be worth being explicit about this in the spec. Could you put up an issue on jgm/CommonMark so I won’t lose track?
opened 05:16AM - 21 Mar 17 UTC
closed 04:55AM - 07 Apr 19 UTC
Follow up to discussion [here](https://talk.commonmark.org/t/do-these-links-rend… er-as-expected/2374/4?u=mcwumbly).
This issue is to track the proposal to add some text and example to illustrate the case where a link reference definition is made with no matching link reference. This is already implicitly documented by [this example](http://spec.commonmark.org/0.27/#example-538) but could be more clear with specific text and an example.
---
The following are suggestions for possible additions:
When a link reference definition does not match any link reference, it is still treated as a link reference definition. Therefore it will not appear in the output.
Example:
Here, `[foo]:` is parsed as a link reference definition, but there is do matching link reference so it does not appear in the output.
```text
some text
[foo]: /url
```
```text
<p>some text</p>
```