From b2643973d25d38ff2ceec53579233c70bf6e272c Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Tue, 1 Nov 2022 19:07:13 +1100 Subject: [PATCH] fix: ensure HTML flags apply to --html-styles Fixes #639 --- cmd/chroma/main.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cmd/chroma/main.go b/cmd/chroma/main.go index 7bce609f1..50b31818e 100644 --- a/cmd/chroma/main.go +++ b/cmd/chroma/main.go @@ -205,21 +205,18 @@ func main() { style, err := builder.Build() ctx.FatalIfErrorf(err) + if cli.Formatter == "html" { + configureHTMLFormatter(ctx) + } + // Dump styles. if cli.HTMLStyles { - options := []html.Option{html.WithClasses(true)} - if cli.HTMLAllStyles { - options = append(options, html.WithAllClasses(true)) - } - formatter := html.New(options...) + formatter := formatters.Get("html").(*html.Formatter) err = formatter.WriteCSS(w, style) ctx.FatalIfErrorf(err) return } - if cli.Formatter == "html" { - configureHTMLFormatter(ctx) - } if len(cli.Files) == 0 { var contents string var lexer chroma.Lexer