Documentation
¶
Overview ¶
Package server implements the md-preview HTTP+WebSocket preview server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run starts the server, reads JSON commands from stdin, and blocks until stdin closes or the process is interrupted. On {"type":"quit"} the process exits with status 0.
The startup line "[md-preview] Serving on http://localhost:<port>/" is written to stdout so external tooling parsing it keeps working.
Types ¶
type Options ¶ added in v0.1.2
type Options struct {
File string
Port int
Theme string
Colemak bool
Watch bool
OnListen func(port int)
}
Options configures Run. Watch enables the editor-agnostic file watcher (mtime polling). OnListen, if non-nil, is invoked with the actual bound port once net.Listen succeeds — useful when Port is 0 (ephemeral) and the caller needs the address to open a browser.
Click to show internal directories.
Click to hide internal directories.