Skip to content

Commit a499feb

Browse files
committed
commands: Deprecate --omitEmpty on chromastyles command
It's no longer needed -- empty classes are now always omitted. See See alecthomas/chroma@5b2a4c5
1 parent 429ca76 commit a499feb

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

commands/gen.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ See https://xyproto.github.io/splash/docs/all.html for a preview of the availabl
8282
return err
8383
}
8484

85-
var options []html.Option
8685
if omitEmpty {
87-
options = append(options, html.WithClasses(true))
88-
} else {
89-
options = append(options, html.WithAllClasses(true))
86+
// See https://github.com/alecthomas/chroma/commit/5b2a4c5a26c503c79bc86ba3c4ae5b330028bd3d
87+
hugo.Deprecate("--omitEmpty", "Flag is no longer needed, empty classes are now always omitted.", "v0.149.0")
88+
}
89+
options := []html.Option{
90+
html.WithCSSComments(!omitClassComments),
9091
}
91-
options = append(options, html.WithCSSComments(!omitClassComments))
9292
formatter := html.New(options...)
9393

9494
w := os.Stdout

testscripts/commands/gen.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ stdout 'Generated using: hugo gen chromastyles --style monokai'
1515
! hugo gen chromastyles --style __invalid_style__
1616
stderr 'invalid style: __invalid_style__'
1717

18-
# Issue 13475
18+
# Not empty classes.
19+
# From Hugo 0.149.0 empty classes are always removed, so no need for the omitEmpty flag.
1920
hugo gen chromastyles --style monokai
20-
stdout '{ }'
21-
hugo gen chromastyles --omitEmpty --style monokai
22-
! stdout '\{ \}'
21+
! stdout '{ }'
22+
hugo gen chromastyles --omitEmpty --style monokai --logLevel info
23+
stderr 'INFO deprecated: --omitEmpty was deprecated'
24+
25+
# Disable class comments.
26+
hugo gen chromastyles --style monokai
27+
stdout 'GenericSubheading'
28+
hugo gen chromastyles --omitClassComments --style monokai
29+
! stdout 'GenericSubheading'

0 commit comments

Comments
 (0)