1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-17 20:58:08 +02:00

fix: ensure HTML flags apply to --html-styles

Fixes #639
This commit is contained in:
Alec Thomas 2022-11-01 19:07:13 +11:00
parent d0e811c0ef
commit b2643973d2

View File

@ -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