Documentation
¶
Overview ¶
Package browser wraps go-rod with two flavors used by mdoc:
- Headless: a one-shot headless instance for the print pipeline.
- AppMode: a chromeless app window pointing at a URL, used by `mdoc open`.
Both share the same chromium discovery logic (packaged in the user cache directory, with a system Chromium as fallback).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveBinary ¶
ResolveBinary returns the chromium binary path: prefers the packaged copy under <UserCacheDir>/mdoc/chromium, falls back to a system Chromium found via launcher.LookPath().
Types ¶
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser is a thin handle around a go-rod browser + initial page.
func AppMode ¶
AppMode starts Chromium in chromeless --app=<url> mode (no tab strip, no URL bar) so the preview window looks like a desktop app.
func (*Browser) RodBrowser ¶
RodBrowser exposes the underlying go-rod browser for callers that need to wait on browser-level events (e.g. detecting the user closing an app-mode window).
type InstallResult ¶
type InstallResult struct {
// BinPath is the absolute path of the Chromium executable.
BinPath string
// Revision is the Chromium revision that ended up installed.
Revision int
// Downloaded is true when this call actually fetched and unpacked a
// new Chromium; false when a compatible one was already in the cache.
Downloaded bool
}
InstallResult describes the outcome of an Install call.
func Install ¶
func Install(revision int, logger utils.Logger) (*InstallResult, error)
Install downloads a Chromium snapshot into <UserCacheDir>/mdoc/chromium. If revision is < 0, the latest revision known to go-rod is used. When a compatible binary is already present nothing is downloaded.
If logger is non-nil it receives go-rod's fetchup events (Download:, Progress:, Downloaded:, Unzip:) for the CLI to render its own UI.