We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0eaefbc commit 9a59d9aCopy full SHA for 9a59d9a
services/gitdiff/highlightdiff.go
@@ -201,5 +201,17 @@ func (hcd *highlightCodeDiff) recoverOneDiff(diff *diffmatchpatch.Diff) {
201
sb.WriteString(tokenToRecover)
202
}
203
204
+ if len(tagStack) > 0 {
205
+ // close all opening tags
206
+ for i := len(tagStack) - 1; i >= 0; i-- {
207
+ tagToClose := tagStack[i]
208
+ // get the closing tag "</span>" from "<span class=...>" or "<span>"
209
+ pos := strings.IndexAny(tagToClose, " >")
210
+ if pos != -1 {
211
+ sb.WriteString("</" + tagToClose[1:pos] + ">")
212
+ } // else: impossible. every tag was pushed into the stack by the code above and is valid HTML opening tag
213
+ }
214
215
+
216
diff.Text = sb.String()
217
0 commit comments