Skip to content

Commit c8107f8

Browse files
committed
remove unnecessary bytes.Count
1 parent 49f62a4 commit c8107f8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

modules/highlight/highlight.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,10 @@ func File(fileName, language string, code []byte) ([]string, error) {
193193

194194
_ = htmlWriter.Flush()
195195

196-
m := make([]string, 0, bytes.Count(code, []byte{'\n'})+1)
197-
198196
// at the moment, Chroma generates stable output `<span class="line"><span class="cl">...\n</span></span>` for each line
199197
htmlStr := htmlBuf.String()
200198
lines := strings.Split(htmlStr, `<span class="line"><span class="cl">`)
199+
m := make([]string, 0, len(lines))
201200
for i := 1; i < len(lines); i++ {
202201
line := lines[i]
203202
line = strings.TrimSuffix(line, "</span></span>")

0 commit comments

Comments
 (0)