Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: ensure HTML flags apply to --html-styles
Fixes #639
  • Loading branch information
alecthomas committed Nov 1, 2022
1 parent d0e811c commit b264397
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmd/chroma/main.go
Expand Up @@ -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
Expand Down

0 comments on commit b264397

Please sign in to comment.