Reading view: reference links do not follow CommonMark's label rules (spaces, brackets, chained labels)

Steps to reproduce

Paste each sample into its own note and open Reading view.

[ a ] and [a]

[a]: https://example.com
[a]

[ a ]: https://example.com
[foo][bar][baz]

[baz]: https://example.com
[foo][ref[]

[ref[]: https://example.com

Did you follow the troubleshooting guide?

Yes (reproduced in the sandbox vault, no community plugins).

Expected result

CommonMark 0.31.2 trims a label and collapses its inner whitespace before matching, pairs [foo][bar][baz] from the left, and forbids unescaped brackets in a label:

  1. [ a ] and [a] are both links.
  2. [a] is a link to the [ a ]: definition.
  3. [foo] + a link with text bar to the [baz] destination (spec example 569).
  4. No link and no definition: both lines are text (spec example 546).

Actual result

  1. [ a ] stays text; only [a] is a link.
  2. [a] stays text.
  3. [foo][bar] stays text and baz is the link.
  4. The second line is taken as a definition (it disappears), and the first renders as [foo]ref[].

Environment

SYSTEM INFO:
	Obsidian version: 1.14.5
	Installer version: 1.14.4
	Operating system: Windows 11 Pro 10.0.26300
	Login status: not logged in
	Language: en
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Sandbox vault, no community plugins, default theme and settings.

Additional information

Measured on the CommonMark 0.31.2 spec examples (546, 569, and also 545, 552, 571) and on the samples above, in Reading view.

A smaller case of the fourth sample, with no definition and no closing bracket at all. Paste each line into its own note and open Reading view:

[x][
a [][
[x][z

Expected: every character stays. CommonMark 0.31.2 reads all three as text.

Actual: the [ after the first ] disappears, giving [x], a [] and [x]z. The source keeps the [, and Source mode and Live Preview show it.

The [foo]ref[] in the fourth sample above is the same loss. After [foo], no ] ever closes the [ that opens [ref[, and that [ is dropped along with [foo]. It looks like the reference parser reads [x][ as the shortcut reference [x] and then keeps the [ it read ahead. A full reference is not affected: [text][ref][ keeps its last [.

Same on 1.14.5 and 1.15.0, sandbox vault, no community plugins.