Run artifact

workspace/targets/commonmark/blueprint/FEATURE-Link-Reference-Definitions.md

FEATURE: Link Reference Definitions

FieldValue
Version20261014 V1
DescriptionExtract link reference definitions when a paragraph closes and provide the document-wide reference map and label normalization.
Depends OnFEATURE-Block-Engine.md
Providesreference map, normalize_label
Consumesblock tree builder

Purpose

Implement the Link reference definitions section of the spec and the label matching shared with links and images.

Rules

Reads

Writes

Programmatic Acceptance

The corpus section needs headings, quotes, setext headings and links, so it is gated in the tabs story. The checks here are bounded and use paragraph counts.

=== AC defs-definition-only-renders-nothing ===
Intent: A document that is only a definition, with or without a title or angle brackets, renders no paragraph.

import subprocess

for source in ['[foo]: /url "title"\n', "[foo]:\n/url\n'title'\n", "[foo]: <>\n"]: result = subprocess.run(["./commonmark"], input=source, capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<p>") == 0 === END AC defs-definition-only-renders-nothing ===

=== AC defs-remainder-is-paragraph ===
Intent: Text after a definition stays as one paragraph.

import subprocess

rest = "remaining text" result = subprocess.run(["./commonmark"], input="[foo]: /url\n" + rest + "\n", capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<p>") == 1 assert rest in result.stdout === END AC defs-remainder-is-paragraph ===

=== AC defs-trailing-text-not-definition ===
Intent: Extra text after the title means the line is not a definition, so it stays a paragraph.

import subprocess

result = subprocess.run(["./commonmark"], input='[foo]: /url "title" ok\n', capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<p>") == 1 === END AC defs-trailing-text-not-definition ===

=== AC defs-cannot-interrupt-paragraph ===
Intent: A definition line directly after paragraph text is part of that paragraph.

import subprocess

definition = "[bar]: /baz" result = subprocess.run(["./commonmark"], input="Foo\n" + definition + "\n", capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<p>") == 1 assert definition in result.stdout === END AC defs-cannot-interrupt-paragraph ===

=== AC defs-title-with-blank-line ===
Intent: A title containing a blank line is not valid, so the two halves become two paragraphs.

import subprocess

result = subprocess.run( ["./commonmark"], input="[foo]: /url 'title\n\nwith blank line'\n", capture_output=True, text=True, ) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<p>") == 2 === END AC defs-title-with-blank-line ===

User Acceptance

Guardrails