Skip to content

Commit d5de026

Browse files
alecthomasclaude
andcommitted
docs: correct stale style and HTML formatter doc comments
synthesise's line-number comment described values the code never used; WithCSSComments' description was wrong; HighlightLines and WithLinePrompts did not mention that ranges follow BaseLineNumber. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 7c759ac commit d5de026

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

formatters/html/html.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ func WithCustomCSS(css map[chroma.TokenType]string) Option {
3737
}
3838
}
3939

40-
// WithCSSComments adds prefixe comments to the css classes. Defaults to true.
40+
// WithCSSComments prefixes each generated CSS rule with a comment naming its
41+
// token type. Defaults to true.
4142
func WithCSSComments(b bool) Option { return func(f *Formatter) { f.writeCSSComments = b } }
4243

4344
// TabWidth sets the number of characters for a tab. Defaults to 8.
@@ -122,9 +123,11 @@ func WithLinkableLineNumbers(b bool, prefix string) Option {
122123
}
123124
}
124125

125-
// HighlightLines higlights the given line ranges with the Highlight style.
126+
// HighlightLines highlights the given line ranges with the Highlight style.
126127
//
127-
// A range is the beginning and ending of a range as 1-based line numbers, inclusive.
128+
// A range is the beginning and ending of a range as 1-based line numbers,
129+
// inclusive. Ranges are matched against displayed line numbers, so they
130+
// follow BaseLineNumber.
128131
func HighlightLines(ranges [][2]int) Option {
129132
return func(f *Formatter) {
130133
f.highlightRanges = ranges
@@ -134,7 +137,9 @@ func HighlightLines(ranges [][2]int) Option {
134137

135138
// WithLinePrompts adds a non-selectable prompt before each line in the given ranges.
136139
//
137-
// A range is the beginning and ending of a range as 1-based line numbers, inclusive.
140+
// A range is the beginning and ending of a range as 1-based line numbers,
141+
// inclusive. Ranges are matched against displayed line numbers, so they
142+
// follow BaseLineNumber.
138143
func WithLinePrompts(prompt string, ranges [][2]int) Option {
139144
return func(f *Formatter) {
140145
f.linePrompt = prompt

style.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ func (s *Style) synthesise(ttype TokenType) StyleEntry {
462462
case LineHighlight:
463463
return StyleEntry{Background: bg.Background.BrightenOrDarken(0.1)}
464464

465-
// If we don't have line numbers, use the text colour but 20% brighter/darker
465+
// If we don't have line numbers, derive a colour from the background, 50% brighter/darker.
466466
case LineNumbers, LineNumbersTable:
467467
return text
468468

0 commit comments

Comments
 (0)