"bytes"
"context"
"fmt"
+ "html"
"html/template"
"io"
"io/ioutil"
// escape a line's content or return <br> needed for copy/paste purposes
func getLineContent(content string) string {
if len(content) > 0 {
- return content
+ return html.EscapeString(content)
}
- return "\n"
+ return "<br>"
}
// DiffSection represents a section of a DiffFile.
diffRecord := diffMatchPatch.DiffMain(highlight.Code(diffSection.FileName, diff1[1:]), highlight.Code(diffSection.FileName, diff2[1:]), true)
diffRecord = diffMatchPatch.DiffCleanupEfficiency(diffRecord)
- diffRecord = diffMatchPatch.DiffCleanupEfficiency(diffRecord)
-
return diffToHTML(diffSection.FileName, diffRecord, diffLine.Type)
}