mark.Run and ProcessFile were writing directly to os.Stdout via
fmt.Println, which is a surprising side-effect for library callers.
Add Config.Output io.Writer for callers to provide their own sink.
When nil the helper falls back to io.Discard, so library embedders
that do not set Output receive no implicit stdout writes. The CLI
layer sets Output: os.Stdout to preserve existing behaviour.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- util/cli.go: RunMark() now maps CLI flags into mark.Config and
delegates to mark.Run(); all core processing logic removed
- util/cli_test.go: absorb Test_setLogLevel from deleted main_test.go
- main.go, main_test.go: removed (entry point is now cmd/mark/main.go)
- Makefile: update build target to ./cmd/mark with -o mark
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The D2Scale property of MarkConfig was never initialized, leading to a
default value of 0 being passed to the D2 renderer. This eventually led
to calling chromedp.ScreenshotScale with a scale value of 0. Chrome
doesn't like this, and never finishes the sceenshot operation.
Fixes#610
Move a number of funcs/files in the top-level `main` package into a new
`util` package, so test logic can directly invoke functions like
RunMark(), etc. The main.go has been trimmed down to minimal sizing,
with former supporting funcs moved into `util` package, so they
can be run by unit tests.
Signed-off-by: Rich Scott <richscott@sent.com>