Run artifact

evidence/prompt_outputs/20261014.063246.323Z_commonmark_build_claude.output.txt

I'll start by checking the build directory, the existing sources, and what's already committed.The project already has an `mdparser` package from earlier blocks. I'll read the inline and reference code this step builds on.The inline scanner is a single left-to-right pass, and emphasis uses a delimiter stack. Next I need to see how the reference map reaches the inline parser, and how the existing tests are organised.The inline parser only receives raw text, so it has no access to the document's reference map yet. I'll check how the block tree holds that map, and how the existing tests call `parse_inline`.Baseline is green: 523 passed, 1 skipped. The link grammar I need (destination, title, label scan) is private in `refs.py`, so I'll check that no test depends on those private names before I make them shared.Nothing outside `refs.py` uses those helpers, so I'll make the four link-grammar helpers public. Then I'll add the link tail matcher in a new `links.py`.Now the link tail module: inline `(destination "title")` and the full, collapsed, and shortcut reference forms.Next, `inlines.py`. I'll add the link and image nodes, the bracket openers on the delimiter stack, and the look-for-link-or-image step.Next, the scanner branches and the renderer for the new nodes.Now the `DelimiterStack` methods the procedure calls: find the nearest opener, remove it, deactivate earlier `[` openers, and close one over its content.Last wiring step: the CLI passes the document's reference map into the inline parser.Before writing the test file, I'll run the six declared acceptance snippets and a few spec examples directly, so I can see the behaviour.The outputs match the spec behaviour I checked, including the spec's `[foo][bar][baz]` case and the nested-link case. Next I'll write the test file: the six declared acceptance checks transcribed as written, then finer tests for each form and boundary.Before running, I re-checked the expectations by hand and found four that are wrong: the `"` in a bare destination percent-encodes to `%22`, the `<b<c>` case has a raw HTML tag after it, and two reference tests don't test what their names say. I'll correct them.The `[x]]` replacement doesn't test what its name says, so I'll remove it rather than keep a misleading test. Then I'll run the new file and the full suite.The full suite is green: 581 passed, 1 skipped. That is the prior 523 plus my 58, with no regressions. I'll check line lengths against the project's style and remove my scratch files from `/tmp`.The `links` block is built. The six declared acceptance checks pass, and the full pytest suite is green at 581 passed with 1 skipped; the skip predates this step.

I did not run `sh sources/full_test.sh`. The Links corpus section needs image rendering, and the feature spec gates it in the images story. I also didn't run the staged conformance runner unscoped, since no criterion in this step invokes it.

**What was built**
- **Bracket procedure** (`mdparser/inlines.py`): `[` and `![` push openers on the existing delimiter stack. On `]`, the nearest opener is tried for an inline link, then full `[label]`, collapsed `[]`, and shortcut forms. Success builds a link over the nodes after the opener and runs emphasis inside it. Earlier `[` openers are deactivated so links never nest. A failed or inactive opener leaves `]` literal.
- **Link tails** (`mdparser/links.py`, new): inline `(destination "title")` matching, plus the reference forms. A following label that doesn't resolve fails the link rather than falling back to shortcut.
- **Reference map**: `parse_inline` takes an optional `references`. `cli.py` passes the document's map, so definitions after a paragraph still resolve.
- **Shared grammar**: four helpers in `refs.py` (`scan_label`, `parse_destination`, `parse_title`, `skip_whitespace_with_line_ending`) are now public so `links.py` can use them. Nothing outside `refs.py` used the old private names.
- **Tests** (`tests/test_links.py`, new, 58 tests): the six declared acceptance checks transcribed as written, plus tests per form, destination and title grammar, label boundaries (999 and 1000 characters), nesting and deactivation, and executable-level round trips.

**Choices I made that you may want to change**
- **Images**: `![` constructs are consumed correctly, but they render as their literal source (for example `![foo](/url)`). The spec leaves image rendering to the images story, and I didn't want to render `<img>` early.
- **Parentheses depth**: the spec text says "at least three levels", and I used unlimited balanced depth, which satisfies that.
- **Empty title**: an empty title is omitted from the `title` attribute, matching the reference behaviour.

FILES CHANGED are listed below. I did not stage or commit anything.

```text
<blueprint-decisions>
[{"spec":"FEATURE-Links.md","severity":"Material","subject":"Image (![) constructs","decision":"The ![ opener and its inline or reference tail are matched and consumed with the same machinery, but the image is emitted as its literal source text, escaped. Rendering <img> was left to the images story as the build instructions require. Is that acceptable, or should the images story replace this on replan?"},{"spec":"FEATURE-Links.md","severity":"Low","subject":"Destination parenthesis depth","decision":"The spec text says balanced parentheses to at least three levels. I reused the balanced-depth matcher from refs.py, which has no depth limit. Is an unlimited depth acceptable?"}]
</blueprint-decisions>

RESULT: SUCCESS

FILES CHANGED:
- mdparser/links.py
- mdparser/inlines.py
- mdparser/refs.py
- mdparser/cli.py
- tests/test_links.py

SUMMARY:
Implemented the look-for-link-or-image procedure for links with inline, full, collapsed and shortcut reference forms. The six FEATURE-Links acceptance checks pass as written (tests/test_links.py, 58 tests in that file). Full pytest suite: 581 passed, 1 skipped (pre-existing). The unscoped conformance runner (sources/full_test.sh) was not run, since the Links corpus section is gated in the images story. Images are consumed but rendered as literal source until the images story.

BLOCKERS:
- None.
```