Conversation
No behavior change. DiffViewer's /api/file-content fetch (abort on change, loading flag, silent fallback) becomes a hook so the all-files view can reuse it for Markdown previews later.
Optional, additive seams for hosts that render a document outside a Viewer: resolveLocalLink feeds the existing LocalLinkContext, and the new ImageResolverContext lets a host pick an image's URL or show an inert placeholder instead of fetching it (markdown images and raw-HTML <img>). Absent props render exactly as before.
Fixes found while reviewing the rendered Markdown preview:
- Links never navigate the review tab. A relative link to a file in this
review opens it in the review; any other local link (and raw-HTML link)
renders inert ("Not in this review"); http(s) opens a new tab with
noopener; in-page #anchors scroll inside the preview.
- The header Comment button works in the preview: the file composer is
mounted outside the diff/preview branches, so it no longer opens later
on a stale anchor.
- Images resolve against the Markdown file's own folder (as an absolute
path, never the server cwd), and only when the working tree is the
revision on screen (local Git uncommitted / unstaged / since-base /
local-vs-remote, worktrees included). Deleted files, PR, workspace,
static-patch, committed and non-Git diffs show a placeholder instead.
TODO(review-image-route) marks the per-revision route for later.
- Navigation into the file (sidebar jump to a line comment, a search hit,
a semantic-diff / AI scroll-to-lines selection) switches back to the
diff first, then runs; a file comment scrolls in place in the preview.
- The preview shows only a document that still matches the patch line by
line; one edited since the diff was captured says so.
- No toggle where a preview cannot work (static patch) or for a rename
away from Markdown; .markdown and config.json `markdownExtensions`
(now shipped on /api/diff by both runtimes) count as Markdown.
- One stable accessible name ("Markdown preview") with aria-pressed.
- File comments sit below image / binary / oversized notices again.
- Files over 300 KB ask first ("Large file · Preview anyway").
…nchors With a host image resolver, raw-HTML media is decided on an inert <template> before insertion, so nothing loads from the page origin first: img srcset/sizes are dropped, <picture><source> is dropped (the <img> is the fallback), and <video> (src, poster, sources) becomes a placeholder. An image the resolver chose that fails to load becomes the same placeholder instead of a broken-image icon. New optional headingAnchors prop gives headings the Viewer's slug ids. A host passing none of the seams renders exactly as before; RenderedMarkdown.hostSeams.test.tsx compares the DOM with the pre-seam body (registered in the DOM test step).
… diffs - CRLF: line endings never count when the preview checks the document against the patch (core.autocrlf / eol=crlf print LF in the diff while the file on disk has CRLF), so CRLF files no longer read as "changed after the diff was captured". - Subfolder launch: GitContext gains `root` (rev-parse --show-toplevel, already computed in getGitContext; both runtimes through the shared core). Preview images resolve against it instead of the invocation cwd, which doubled the folder and could load another file. - A whole-diff 409 from /api/file-content (useFileContents `stale`) shows the stale wording, not "unavailable". - Headings get slug ids in the preview, so `[jump](#section-two)` scrolls. - Media: raw-HTML srcset / <picture> sources / <video> never load from the page origin (via the ui resolver), and an image that fails to load (an absolute path such as /tmp/x.png) shows the placeholder.
…nder seams computePlanDiff fills each block's source lines on both sides; the pure foldUnchangedPlanDiff folds long unchanged runs. PlanCleanDiffView gains optional renderBlock, lineGutter, foldUnchanged and unchangedClassName for code review's rendered Markdown diff. Plan review passes none of them and renders the same DOM.
…eviewSupported advert GET /api/review-markdown-image serves only an image the Markdown file in the patch references at that side, resolved against its own folder at that revision, through the same per-side reader, caps, sniffing and headers as /api/review-image (both runtimes). Every diff payload advertises markdownPreviewSupported (false for a static patch).
…rry their quote CodeAnnotation gains an optional markdownPreview anchor (the selected text, the view, the rendered-diff section). The export prints the quote under the file; a PR review always puts it in the body, never inline or as a file-level thread; the sidebar and the file comment banner show the quote; the feedback archive records it as originalText.
… rendered diff and whole file Built to the owner-approved design (variant C): - Each Markdown file's header has Source | Preview; Preview .md beside Split | Unified sets every Markdown file at once (a file's own choice wins until it is pressed again). Source by default; the switch is remembered in a cookie. P / Shift+P in a new code-review shortcut scope. Previewed files show an eye in the file tree. - Preview shows the rendered diff (PlanCleanDiffView through BlockRenderer: sections added, removed and changed, unchanged runs folded, source lines in a gutter) or the whole new version, with diagrams through the diagram engine and images from that side's revision. - Select text to comment, as on the PR description; the comment is found by its text in either view and says when it is not there. - All files: the card lives in the item's header slot and the item carries a hunkless diff while previewed. - Without the server's markdownPreviewSupported advert there is no preview UI. - Replaces the working-tree image root with the per-revision image route.
AllFilesCodeView, FileHeader and the shared UI changed, so the portable viewer's bytes changed. The new viewer files must be uploaded to guides.show /v1/ before a release that pins them.
…kdown preview Mermaid and Graphviz are loaded the same lazy way as in plan review (never registered eagerly); the single-file build inlines them.
…time in the review bundle Owner decision (approval record, 2026-10-12 amendment): performance wins. The preview lazy-imported MermaidBlock and GraphvizBlock, but the single-file review build inlines every dynamic import, so every review page carried the Mermaid and Graphviz runtimes (17.07 MB -> 23.79 MB, ~600 ms slower to the file tree). Mermaid and Graphviz fences now render through BlockRenderer as code blocks, as the original preview did. tests/entry-assets.test.ts: the review bundle's diagram markers are asserted absent again, and a source guard fails if the review app (review-editor, guide-viewer, apps/review) imports a diagram module, statically or lazily.
Drawn 36 px as before; an ::after box reaches 4 px past each edge, inside the 44 px compact header.
…rces as written; none from code - In a PR review (someone else's file) a remote image (https://, http://, //host) is held behind a placeholder, with "N remote images are not loaded" and Load remote images above the document; a click on the button or on a held placeholder loads them. Opening a preview no longer tells a tracking pixel's server the reviewer's IP address. Repository images still load through the review route; local reviews are unchanged. `holdRemoteImages` overrides the default. - The client sends an image source exactly as written (it trimmed it); the route drops leading and trailing ASCII whitespace from the source and from every reference alike, as a browser's URL parser does. - An image written inside a fenced code block or an inline code span is not a reference (`stripMarkdownCode`), so the route does not read it.
`jj file show -- <path>` parses the path as a fileset expression, so a file named `a|b.png` read the union of `a` and `b.png` (and `~`, `&`, quotes and pattern prefixes changed the read too). Paths reach these reads from the diff and, for the Markdown preview, from a Markdown file the review shows. Both jj reads (image bytes for /api/review-image and /api/review-markdown-image, and full-file contents) now pass `root-file:"…"` with jj's string-literal escapes (`jjRootFileFileset`). Shared by both runtimes (Pi vendors jj-core); the new test runs both runtimes' spawners against a real jj repo and is skipped without jj.
…ages, literal jj paths; regenerate the viewer manifest The FileHeader change moved the portable viewer's bytes again. New files for guides.show /v1/ (vs origin/main): viewer.BI4gLR6G.js, viewer.BZJaSXfa.css, chunks/index.Dwn6LLPq.js. The PR's earlier pin (viewer.BFq_0itW.js / viewer.DrS4u596.css) is superseded and need not be uploaded.
…-block layout The review stylesheet never carried `pre code.pn-code` (padding, background, soft wrap), so fenced code in the preview, now including every Mermaid and Graphviz fence, sat flush against its border. Scoped to [data-markdown-preview]. The rule reaches the portable viewer's stylesheet, so the manifest is regenerated: guides.show /v1/ needs viewer.-C7ZESu6.css (in place of viewer.BZJaSXfa.css from the previous commit), plus viewer.BI4gLR6G.js and chunks/index.Dwn6LLPq.js.
Owner's controls amendment (2026-10-12, variant "Menu"): the "Preview .md"
button beside Split | Unified, the per-file Source | Preview switch and the
in-file Changes | Whole file strip become one button in each Markdown
file's header that names the view ("Source ▾") and opens a menu: Source,
Changes (the rendered diff), Read (the whole document rendered, no marks).
Added and deleted files, and a rename that changed nothing, offer Source
and Read only.
- The menu is Base UI's (already in the review bundle): menuitemradio items
with aria-checked, arrows, Home/End, type-ahead, Escape back to the
button. On the compact touch shell the same button (44 px hit area)
opens the same items as a bottom sheet titled "Show <file> as".
- Files start in Source. A view picked on any Markdown file becomes the
starting view for every Markdown file not set by hand (they follow on
screen) and is remembered for the next review in the cookie
plannotator-markdown-view; the old plannotator-markdown-preview-all=true
reads once as Changes and is rewritten under the new name. A file set by
hand keeps its view. Navigation (a search hit, a comment that lives in
another view, "Show in Changes / Read") sets one file and remembers
nothing.
- P steps the current file Source -> Changes -> Read -> Source, skipping
Changes where there is none. Shift+P is gone: a pick already moves every
file not set by hand, so an all-files key would only override files the
person set on purpose.
- FileHeader no longer draws the control (a render slot); DiffViewer and the
All files panel do, so the read-only guides.show viewer carries none of
it. The New file / Deleted label inside the file is gone (the header's
status letter and the rail say it); the renamed-unchanged note, the "not
in this view" note, remote images and the size guard stay.
Moving the Markdown view control out of FileHeader shrinks the portable viewer (viewer js 399.8 -> 399.3 KB gz, budget 400). New files for guides.show /v1/: viewer.BZSPnG6O.js, viewer.CLo4ZxuQ.css, chunks/index.BClgkBDG.js (in place of viewer.BI4gLR6G.js, viewer.-C7ZESu6.css and chunks/index.Dwn6LLPq.js from the previous pin). The worker is unchanged.
isRemoteImageSource only matched `//` after the scheme, so raw-HTML sources a browser still fetches from another server loaded at once: `https:tracker.example/a.png`, `https:/host/…`, `https:\\host\…` and `\\host\…`. It now reads a source the way a URL parser does (tabs and line breaks dropped, leading controls trimmed, a backslash counts as a slash) and treats every http(s): source and every `//` or `\\` start as remote. Held ones are placeholders, so the "N remote images are not loaded" count includes them.
… file in view - `P` read `event.target`, which at window level is the shadow host, so typing `p` in the Pierre editor (an edit session) switched the file's view. The guard now reads composedPath()[0]. - The file that holds the edit session (All files) has its view locked: its menu is disabled with "Finish editing first", and `P`, picks and navigation leave it alone. AllFilesCodeView reports the session's file through markdownPreview.onEditingFileChange; the controller keeps the lock (lockReason / setEditingFile). - In All files `P` acted on the "visible file", which is the last file when everything fits or the view is at the bottom. It now resolves its target when the key is pressed: the Markdown file holding focus, else the one under the pointer, else the top-most Markdown file in the viewport (markdownPreview.registerViewTarget). - The desktop menu is w-96 with shorter descriptions, one line each; "select text to comment" stays in the button's title. - A navigation `show()` pins its file for the session like a pick does; documented in AGENTS.md, with the edit lock, the P target and the remote image rule. DiffViewer's lazy-import comment no longer mentions a diagram engine.
Only conflict: packages/ui/HANDOFF.md, where both sides appended a section at the same anchor; both kept.
Viewer js 399.6 KB gz (budget 400; origin/main alone builds 398.6). New files for guides.show /v1/: viewer.ClAkOVYu.js, viewer.BbPFXtTg.css, chunks/index.CkXCVVsO.js (in place of viewer.BZSPnG6O.js, viewer.CLo4ZxuQ.css and chunks/index.BClgkBDG.js). The worker and the grammar chunks are unchanged.
…move the rest The edit lock refused only picks and P aimed at the editing file. A pick or P on another file moved the starting view, and the editing file (no override, the normal case) followed it: its Read card rendered above the live editor, and when the edit ended the swap never re-ran, so the file stayed half-switched; a search hit there asked for Source, was refused, and never scrolled. - Starting the lock pins the file's current view as an override (as if set by hand), so later picks cannot move it; the pin stays after the edit. - The swap effect also re-runs when the edit session ends. - A search hit in the session's file scrolls in place (it always shows its diff), instead of asking for Source. - The single-file view's menu gets the lock reason too (disabled, "Finish editing first"), and P on a locked file shows it as a toast. - In All files, P's focus and pointer steps count only files intersecting the viewport, never the overscan.
Viewer js 399.6 KB gz (budget 400). New files for guides.show /v1/: viewer.Cs7U8_7B.js and chunks/index.DU_F3bOf.js (in place of viewer.ClAkOVYu.js and chunks/index.CkXCVVsO.js). viewer.BbPFXtTg.css, the worker and the grammar chunks are unchanged.
Contributor
Author
|
@backnotprop tyvm! <3 |
This was referenced Oct 14, 2026
1 task
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.
Summary
Verification
DOM_TESTS=1 bun test packages/review-editor/components/DiffViewer.headerControls.test.tsxbun run build:reviewgit diff --checkbunx tsc --noEmit -p packages/review-editor/tsconfig.jsonwas also attempted; it fails on numerous existing package errors (including missing Bun test typings and errors in unrelated review files). No type errors were reported in the new preview code.