vscode: markdown preview inline REVIEW cards + right-edge marker minimap (#863) - #1056
Merged
Conversation
…w fix) The renderer stamps the same data-line on nested blocks (ul + li). The injection loop ran per-match, producing a duplicate card stack and invalid ul > ul DOM for list/blockquote/table markers. Anchor to the first (outermost) match per line. Pinned by a regression test that fails without the fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PIR Review: Markdown preview marker-aware features — inline REVIEW cards + right-edge minimap
Fixes #863
Summary
The Codev Markdown Preview previously rendered REVIEW markers as a minimal v1 overlay that sat on top of the annotated block, hiding its first lines. This change moves marker display into the
@cluesmith/codev-artifact-canvaspackage as always-visible inline-below comment cards (rendered in document flow beneath each annotated block, so they push following content down instead of overlapping it) plus a new right-edge marker minimap (one dot per REVIEW marker, hover tooltip, click to smooth-scroll). Both surfaces derive from the sameparseReviewMarkerssource of truth and are pure rendering — no new interaction beyond click-to-jump, no on-disk format change. Implementing in artifact-canvas means every host that embeds the canvas inherits the behavior, not just VSCode.Files Changed
packages/artifact-canvas/src/components/ArtifactCanvas.tsx(+~75 / -~35) — inline-below card stacks injected in flow; dropped the overlapping hover overlay marker-list;+affordance anchored to the first line's vertical center; body now set via imperativeinnerHTMLin a[html]-keyed effect (see Lessons)packages/artifact-canvas/src/overlays/MarkerMinimap.tsx(+87 / -0, new) — right-edge fixed dot column; hover title; click → smooth-scroll; hidden when zero markerspackages/artifact-canvas/src/styles/default-theme.css(+~55 / -~15) — card-stack + minimap styles using existing--codev-canvas-*tokens; left-rule +padding-leftso the marker bar clears the annotated textpackages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx(+~50) — updated overlay-marker assertions to inline cardspackages/artifact-canvas/src/components/__tests__/marker-card-persistence.test.tsx(+139 / -0, new) — regression repro for the flash-then-vanish card bugpackages/artifact-canvas/src/overlays/__tests__/marker-minimap.test.tsx(+69 / -0, new) — dot count / hidden-when-empty / click→scrollIntoView / tooltipcodev/plans/863-vscode-markdown-preview-marker.md,codev/state/pir-863_thread.md,codev/projects/863-*/status.yaml— protocol artifactsCommits
f13c6607[PIR vscode: markdown preview marker-aware features — inline REVIEW rendering + right-edge marker minimap #863] Inline-below comment cards + right-edge marker minimapc7869a99[PIR vscode: markdown preview marker-aware features — inline REVIEW rendering + right-edge marker minimap #863] Tests for inline cards and marker minimap256f5788[PIR vscode: markdown preview marker-aware features — inline REVIEW rendering + right-edge marker minimap #863] Fix comment cards vanishing: own markdown body innerHTML imperativelycba892fd[PIR vscode: markdown preview marker-aware features — inline REVIEW rendering + right-edge marker minimap #863] Thread: dev-approval card-disappear finding + fixbe6a2958[PIR vscode: markdown preview marker-aware features — inline REVIEW rendering + right-edge marker minimap #863] Add padding so marker bar doesn't crowd annotated textTest Results
pnpm --filter @cluesmith/codev-artifact-canvas build(tsup): ✓ passpnpm --filter @cluesmith/codev-artifact-canvas test(vitest): ✓ pass (50 tests, ~30 new across the two new test files + updated assertions)node esbuild.js --production): ✓ rebuiltdev-approvalgate): inline cards render below each annotated block with no overlap; multi-comment blocks stack in creation order; zero-comment blocks consume no space; minimap dots persist with working hover tooltip + click-scroll;+add-comment flow intact. The reviewer caught two issues during this gate, both fixed and re-reviewed: (1) added cards flashed then vanished; (2) the marker accent bar crowded the annotated text.Architecture Updates
No arch changes — this PR adds rendering surfaces inside the existing
artifact-canvaspackage (a new internal overlay component + CSS). It introduces no new module boundary, invariant, port, or cross-cutting fact, and does not alter the marker on-disk format or the host adapter contract. Nothing qualifies forarch-critical.md(hot) orarch.md(cold).Lessons Learned Updates
Added one entry to the cold
codev/resources/lessons-learned.md(Debugging and Root Cause Analysis section),[From 863]: React'sdangerouslySetInnerHTMLre-commits the element's innerHTML on every re-render, silently wiping imperatively-injected DOM children — which was the exact root cause of the flash-then-vanish bug the reviewer found at the gate. The fix is the standard escape hatch: setinnerHTMLimperatively in a[html]-keyed effect so React no longer owns that subtree. Routed to cold (not hotlessons-critical.md) because it is a spec-narrow React/webview recipe, not a behavior-changing cross-cutting rule, and the hot tier is at its cap.Things to Look At During PR Review
ArtifactCanvas.tsxbody rendering — the switch fromdangerouslySetInnerHTMLto an imperativeinnerHTMLassignment in a[html]-keyeduseEffect. This is the load-bearing fix for the card-persistence bug; confirm the effect dependency array is exactly[html]and that nested-block markers still resolve (the imperative path must preserve the same parsed DOM the JSX path produced).scrollIntoViewspy, tooltip text), not pixel coordinates, because jsdom has no layout engine. Real proportional placement was verified manually at the dev-approval gate, not in unit tests.--codev-canvas-*tokens; no hardcoded colors. Worth a glance that the new card/minimap rules don't introduce a raw hex outsidedefault-theme.css's token block.How to Test Locally
pir-863→ Review Diffafx dev pir-863codev/(plans|specs|reviews)/*.mdcontaining REVIEW markers in the Codev Markdown Preview+add-comment still works end-to-end (hover →+→ input → marker appears as a new card on refresh);+sits centered on the first line--vscode-*codev/(plans|specs|reviews)markdown file is unaffected (preview opt-in for those paths)