Skip to content

Review a markdown file in its rendered view - #188

Merged
splitbrain merged 1 commit into
splitbrain:mainfrom
splitbrain-bot:review-rendered
Nov 15, 2026
Merged

splitbrain merged 1 commit into
splitbrain:mainfrom
splitbrain-bot:review-rendered

Conversation

@splitbrain-bot

Copy link
Copy Markdown

Summary: A markdown file can be reviewed in its rendered view. The view shows the comments and the changes per block, a tap on a block comments the block, and the reading position survives the switch of the view and a reopen.

Changes:

  • Each top level block of the rendered file gets its source lines from a rehype plugin, and a frame component shows the change marker, the block and the comment cards under it. The toolbar counts and steps through the changed and the commented blocks.
  • A comment on a block writes #### Line 10 to 14 to REVIEW.md. The key stays the first line, a block of one line writes a line comment, and the context holds the block plus three lines on each side. The desktop review tool reads the file and drops the range when it writes it. The annotation API takes an optional endLine.
  • The card of a block comment names its lines in both views, and the source view marks every row of the block.
  • The store remembers a line anchor and the view per file. A switch between source and rendered view keeps the topmost line, and a reopened file comes back in the same view at the same place. Stopping an edit returns the file to its earlier view.
  • The rendered view is off for a markdown file past the 8,000 line limit, because its comments need the rows of the code pane.
  • doc/review.md and doc/rest.md describe the block comments and the range heading.

Notes for the review:

  • Each pane is mounted once per file and records the place of the reader in a layout cleanup. rowOffsets() measures rows against the scroller with bounding rectangles, because the block frames are positioned.
  • In development, StrictMode runs the layout cleanup once at mount, so the preview records no place before it has positioned the file.

Tests: store, route and unit tests for the range heading, the block context, the drift of a block comment, the plugin and the anchors. E2E tests for a block comment on a desktop and on a phone, the markers and steps in the rendered view, and the kept place across a switch and a reopen.

The rendered view of a markdown file showed no comments and no changes,
and a tap on it did nothing. The pane stored the scroll position of a
file in pixels, so the rendered view started at the top, and a reopened
markdown file always came back as source.

Each block of the rendered view now knows its source lines. A tap on a
block opens the composer for the block, a comment shows under the block
that holds its line, a changed block gets the marker of the code pane,
and the toolbar steps through the changed and the commented blocks.

A comment on a block is a block comment. REVIEW.md writes it with the
heading "#### Line 10 to 14", keyed by the first line, and its context
holds the block plus three lines on each side. The desktop review tool
reads such a file and drops the range when it writes it. A block of one
line writes a line comment. The API takes an optional endLine.

The store remembers a line anchor and the view per file in place of the
pixel offset. A switch between the views keeps the topmost line, a line
between two blocks lands on the next block, and a reopened file comes
back in the view it was left in, at the same place. Each pane is mounted
once per file and records the place when it leaves the file.
@splitbrain
splitbrain merged commit f8436f8 into splitbrain:main Nov 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants