From dead2a9b2dc0ec22c0b7c53a17de7b4ce64a2680 Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Wed, 2 Sep 2020 21:19:42 +0100
Subject: [PATCH] Escape failed highlighted code (#12685)

Signed-off-by: Andrew Thornton <art27@cantab.net>
---
 modules/highlight/highlight.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/highlight/highlight.go b/modules/highlight/highlight.go
index a2bf93ee92..1a64108139 100644
--- a/modules/highlight/highlight.go
+++ b/modules/highlight/highlight.go
@@ -8,6 +8,7 @@ package highlight
 import (
 	"bufio"
 	"bytes"
+	gohtml "html"
 	"path/filepath"
 	"strings"
 	"sync"
@@ -160,7 +161,7 @@ func plainText(code string, numLines int) map[int]string {
 		if content == "" {
 			content = "\n"
 		}
-		m[line] = content
+		m[line] = gohtml.EscapeString(content)
 	}
 	return m
 }