Skip to content

Commit

Permalink
Don't emit styles that are missing a class
Browse files Browse the repository at this point in the history
  • Loading branch information
apexskier authored and alecthomas committed May 9, 2020
1 parent cc5e532 commit 809ff9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion formatters/html/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,12 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
if tt == chroma.Background {
continue
}
class := f.class(tt)
if class == "" {
continue
}
styles := css[tt]
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s { %s }\n", tt, f.prefix, f.class(tt), styles); err != nil {
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s { %s }\n", tt, f.prefix, class, styles); err != nil {
return err
}
}
Expand Down

0 comments on commit 809ff9b

Please sign in to comment.