chore(deps): migrate the markdown renderer to goldmark v2 #75

Merged
deadstyle merged 2 commits from chore/74-goldmark-v2 into develop 2026-10-09 07:45:10 -05:00
Owner

Refs #74

The details pane now parses markdown with goldmark v2. What you see in the pane is unchanged. Renovate's PR #73 only added the v2 module next to v1, because v2 is a new module path with a redesigned syntax tree, so the renderer had to be ported by hand. v1 is removed from go.mod.

What changed

  • Renderer port (internal/ui/markdown): bold and italic are separate node types, tight and loose lists come from the list itself, task boxes come from the list item, fenced and indented code are one node type, and tables split into header and body. v2 decodes escapes and entities itself, so the manual decode on inline text is gone (it stays for raw HTML blocks).
  • ADR 0014 records the move to v2.

Verification

  • Same sample document (every element we render) at widths 80, 30 and 12, rendered by the old v1 code and by this branch: visible text and styling are identical. The only difference is where the colour codes sit on checkbox lines.
  • make check: 0 issues., every Go package ok under -race, No vulnerabilities found., binary builds. The ShellCheck step could not run locally (not installed); this diff has no shell changes and CI runs it.
  • New tests, each shown to fail when its fix is reverted (the last two): loose and tight lists, ordered start, indented code, checked loose tasks, autolinks, entities in headings, link text and code spans, control characters in image alt and table headers, wrapped numbered task items.
  • Rendering was compared as text. Layout was not observed in a live terminal.

Review

Three fresh-context reviews.

  • Spec: PASS. It listed untested paths, and tests were added for the risky ones.
  • Standards: FAIL, then fixed. Two real findings: image alt text and table headers stopped stripping control characters after entity decoding (an escape-sequence injection path), and numbered task items wrapped with the wrong indent. Also simplified the HTML block read.
    • Dismissed: list looseness is now decided per list rather than per item, which is the CommonMark rule and differs only for odd items such as an empty bullet inside a loose list.
  • Comments: the one finding says the plain comment is wrong because it never decodes. It does decode (Value(src)), so it was dismissed, and the comment now states the decode and clean order.

Docs

ADR 0014 updated. architecture.md and design.md need nothing: the package boundary and the product behavior are unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PmoSSUtaPYn8npGgDRRZrR

Refs #74 The details pane now parses markdown with goldmark v2. What you see in the pane is unchanged. Renovate's PR #73 only added the v2 module next to v1, because v2 is a new module path with a redesigned syntax tree, so the renderer had to be ported by hand. v1 is removed from go.mod. ## What changed - **Renderer port** (`internal/ui/markdown`): bold and italic are separate node types, tight and loose lists come from the list itself, task boxes come from the list item, fenced and indented code are one node type, and tables split into header and body. v2 decodes escapes and entities itself, so the manual decode on inline text is gone (it stays for raw HTML blocks). - **ADR 0014** records the move to v2. ## Verification - Same sample document (every element we render) at widths 80, 30 and 12, rendered by the old v1 code and by this branch: visible text and styling are identical. The only difference is where the colour codes sit on checkbox lines. - `make check`: `0 issues.`, every Go package `ok` under `-race`, `No vulnerabilities found.`, binary builds. The ShellCheck step could not run locally (not installed); this diff has no shell changes and CI runs it. - New tests, each shown to fail when its fix is reverted (the last two): loose and tight lists, ordered start, indented code, checked loose tasks, autolinks, entities in headings, link text and code spans, control characters in image alt and table headers, wrapped numbered task items. - Rendering was compared as text. Layout was not observed in a live terminal. ## Review Three fresh-context reviews. - **Spec:** PASS. It listed untested paths, and tests were added for the risky ones. - **Standards:** FAIL, then fixed. Two real findings: image alt text and table headers stopped stripping control characters after entity decoding (an escape-sequence injection path), and numbered task items wrapped with the wrong indent. Also simplified the HTML block read. - Dismissed: list looseness is now decided per list rather than per item, which is the CommonMark rule and differs only for odd items such as an empty bullet inside a loose list. - **Comments:** the one finding says the `plain` comment is wrong because it never decodes. It does decode (`Value(src)`), so it was dismissed, and the comment now states the decode and clean order. ## Docs ADR 0014 updated. `architecture.md` and `design.md` need nothing: the package boundary and the product behavior are unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PmoSSUtaPYn8npGgDRRZrR
Renovate's v2 PR only added the new module path. The renderer now walks
the v2 tree: Strong is its own node, tight lists carry Paragraphs (read
from List.IsTight), task items come from TaskStatusOf, code blocks are
one kind, and tables split into header and body. v1 is dropped from go.mod.

Refs #74

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PmoSSUtaPYn8npGgDRRZrR
fix(ui): keep control chars out of alt and header text after the v2 port
All checks were successful
ci / check (pull_request) Successful in 1m6s
ba55949d55
Review of the goldmark v2 port found that image alt text and table
headers no longer stripped control characters after entity decoding, and
that numbered task items wrapped with the wrong indent. Both are fixed,
and tests now cover them plus loose lists, indented code, autolinks and
entity decoding outside paragraphs. ADR 0014 notes the v2 move.

Refs #74

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PmoSSUtaPYn8npGgDRRZrR
deadstyle merged commit 17d713ff4e into develop 2026-10-09 07:45:10 -05:00
deadstyle deleted branch chore/74-goldmark-v2 2026-10-09 07:45:11 -05:00
Sign in to join this conversation.
No description provided.