Skip to content

Commit 96238e9

Browse files
committed
Remove final newline from rendered code
1 parent fd7d83a commit 96238e9

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

modules/highlight/highlight.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ func File(numLines int, fileName, language string, code []byte) []string {
190190
}
191191

192192
htmlw.Flush()
193-
finalNewLine := false
194-
if len(code) > 0 {
195-
finalNewLine = code[len(code)-1] == '\n'
196-
}
197193

198194
m := make([]string, 0, numLines)
199195
for _, v := range strings.SplitN(htmlbuf.String(), "\n", numLines) {
@@ -208,9 +204,6 @@ func File(numLines int, fileName, language string, code []byte) []string {
208204
content = strings.TrimPrefix(content, `</span>`)
209205
m = append(m, content)
210206
}
211-
if finalNewLine {
212-
m = append(m, "<span class=\"w\">\n</span>")
213-
}
214207

215208
return m
216209
}

modules/highlight/highlight_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ steps:
5353
`</span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">go build -v</span>`,
5454
`</span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">go test -v -race -coverprofile=coverage.txt -covermode=atomic</span><span class="w">
5555
</span></span></span>`,
56-
`<span class="w">
57-
</span>`,
5856
},
5957
},
6058
{

0 commit comments

Comments
 (0)