Skip to content

lf-diff has no author notes on a line, unlike lf-code's lf-note #4707

Closed

Description

@max-sixty

What happens

lf-diff draws a patch with a comment button on every line for the reader, but gives the page's author no way to annotate a line. lf-code has this: lf-note at="N" puts a remark under line N, and hi highlights ranges. A page that explains particular hunks of a patch therefore quotes the same lines again in an lf-code block to attach its notes. The reader sees those lines twice, in two visual languages, and lf-code's highlight tint, sitting next to a diff, reads as an added or removed line.

What I expected

Author notes on lf-diff, anchored to a file and an old or new line number and drawn inline under that line, the way lf-code draws lf-note. Optionally, a highlight for line ranges that doesn't use the colours the diff uses for added and removed lines.

Smallest repro

leaf page vocabulary <page> for a page with the diff package lists lf-diff with the properties collapsed, id, overflow, source and view, and no child entries the author can attach to a line. lf-code lists lf-note with at.

Seen on leaf 24cfac4, installed 2026-10-29T00:54:25-07:00.

This was written by Claude Code on behalf of max-sixty

Activity

  1. added
    enhancement
    on Oct 29, 2026
  2. leaf-agent commented on Oct 29, 2026

    @leaf-agent
    Collaborator

    This is a feature request with a reusable addressing mechanism already in place: diff-coordinates.js resolves a file and an old/new source line, including context lines and renamed files. Author notes should use that lookup rather than introduce a second interpretation of patch coordinates.

    There is a shared boundary to fix before adding the drawing. The passage reader withholds an upgraded data widget's entire body, including its prose members. I ran page_passages on <p>Before.</p><lf-code id="sample"><pre>source</pre><lf-note at="1">Author remark.</lf-note></lf-code><p>After.</p> with the default registry; its text was Before. After.. So copying lf-code's rendering alone would give diff notes the same missing file-side passage reading. That withholding protects against accepting quotes from source notation that the widget renders differently; admitting prose members must preserve that protection for the patch itself.

    The implementation should first make declared prose members of data widgets readable independently of their source body, covering existing code notes too. Then the diff package can declare notes addressed by file, side and line, retain their authored nodes through its shadow staging and source refreshes, and draw them under the resolved row using the reader's visible width. Verification needs to cover quoting a note, a collapsed/deferred file opening, and a refreshed patch whose addressed line disappears. The optional range emphasis can follow separately, with a treatment distinct from additions and deletions.

    Leaving this open; no implementation PR was opened in this triage. The next work is the shared authored-prose boundary and its browser/file agreement, followed by inline placement, rather than a diff-only renderer patch.

  3. leaf-agent commented on Oct 30, 2026

    @leaf-agent
    Collaborator

    #4759 implements inline author notes as lf-diff-note children with file, side and at coordinates. It also fixes the shared passage reader so code and diff notes can be quoted independently of source notation. The browser regression covers deferred opening, old/new/context lines, capture agreement and a refresh that removes the addressed line.

    Focused model and browser checks, desktop/phone first-paint checks, pre-commit and pnpm run check passed locally. The review/landing workflow owns the remaining review and CI verification; this run does not wait on CI with await_ci: false. Light, dark and phone comparisons were inspected, but publishing their screenshots failed with a 403 from leaf-assets; the PR records that limitation and the commands to regenerate them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions