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 ¶
OpenBrowser opens url in the user's default browser without waiting for it.
Types ¶
type FileResult ¶
type FileResult struct {
File markdown.File
Status markdown.Status
Review *markdown.ReviewResult // nil when the file was quit (skipped)
}
FileResult is the outcome of reviewing one file.
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
}
Options configures Serve.
type Result ¶
type Result struct {
Files []FileResult
}
Result is the outcome of a browser session: one entry per file that was loaded, in review order. It is empty when the picker was cancelled or the session was interrupted.
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. ok=false skips it; Load reports
// the reason itself.
Load func(path string) (f markdown.File, ok bool)
}
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.