Link reference definitions: three divergences from CommonMark 0.31.2

Author: p5ych0Created Sep 24, 2026Updated Sep 24, 2026

The following cases were run on markdown-it 15.0.2 (default preset, html: true) and compared with commonmark.js 0.31.2, the reference implementation. markdown-it-py 4.2.0 gives the same output as markdown-it, because it is a port.

1. No 999-character limit on a label. Spec §4.7 / §6.3: "A link label can have at most 999 characters inside the square brackets."

[ + 1000 × x + ]: /url

  • commonmark.js: <p>[xxx…]: /url</p>, which is not a definition
  • markdown-it: a definition, so nothing is rendered

2. A title continued onto the next line, with no space before it, is accepted. Spec §4.7: the title "must be separated from the link destination by spaces or tabs". markdown-it passes example 209 ([foo]: <bar>(baz) on one line), but fails when the title continues onto the next line:

- [ref]: <url>"open
  close"
  • commonmark.js: <ul><li>[ref]: <url>"open\nclose"</li></ul>
  • markdown-it 15.0.2: <ul><li></li></ul>, which consumes it as a definition

(markdown-it-py 3.0.0 matches commonmark.js here. 4.x, which tracks markdown-it 14+, does not.)

3. A definition is parsed as a block of its own, not from the start of a paragraph. commonmark.js takes definitions from the start of a paragraph's text, as the spec's parsing-strategy appendix describes, so the lines after a definition still belong to that paragraph. markdown-it ends the block at the definition:

[ref]: /url
    indented

commonmark.js → <p>indented</p>; markdown-it → <pre><code>indented</code></pre>

> [ref]: /url
lazy

commonmark.js → <blockquote><p>lazy</p></blockquote>; markdown-it → <blockquote></blockquote><p>lazy</p>

[ref]: /url "a
+
b"

commonmark.js → a definition whose title spans three lines (an empty list item cannot interrupt a paragraph); markdown-it → the + ends the title, the definition fails, and all three lines render as a paragraph.

The normative text of §4.7 arguably says nothing about the first two cases, and no spec example covers them. The appendix does describe this model, and commonmark.js follows it.

None of these are in the spec's example set.