web

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package web serves the review UI in a web browser. It is the browser counterpart of the tui package: the same documents and comment model, with the review result handed back to the caller when the reviewer submits or quits in the page.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenBrowser

func OpenBrowser(url string) error

OpenBrowser opens url in the user's default browser without waiting for it.

func Serve

func Serve(ctx context.Context, review Review, opts Options) ([]markdown.FileResult, error)

Serve starts the review server on the loopback interface and blocks until every file was finished or skipped in the browser (or the picker was cancelled), or ctx is cancelled, which abandons the whole session. It returns one result per file that was loaded, in review order: none when the picker was cancelled or the session was interrupted.

Types

type Options

type Options struct {
	Port  int    // TCP port on 127.0.0.1; 0 picks a free port
	Theme string // initial color theme: "dark" or "light"
	// Open opens the URL in a browser. nil only prints it.
	Open func(url string) error
	Log  io.Writer // receives the URL and warnings; nil discards them
}

Options configures Serve.

type Review

type Review struct {
	// Pick, when set, is offered in a file picker first (all selected, like
	// the TUI picker); the chosen files are then reviewed in this order.
	Pick []string
	// Paths are reviewed in order when Pick is empty.
	Paths []string
	// Load reads a file when its turn comes (an error skips it), and again
	// when the page is loaded or R is pressed while it is under review.
	Load markdown.Loader
}

Review describes what a browser session reviews. Like the TUI, files are reviewed one at a time, and each is loaded only when its turn comes so that edits made while reviewing an earlier file are picked up.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL