@@ -86,8 +86,8 @@ var globalVars = sync.OnceValue(func() *globalVarsType {
86
86
// codePreviewPattern matches "http://domain/.../{owner}/{repo}/src/commit/{commit}/{filepath}#L10-L20"
87
87
v .codePreviewPattern = regexp .MustCompile (`https?://\S+/([^\s/]+)/([^\s/]+)/src/commit/([0-9a-f]{7,64})(/\S+)#(L\d+(-L\d+)?)` )
88
88
89
- // cleans: "<foo/bar", "<any words/", ("<html", "<head", "<script", "<style")
90
- v .tagCleaner = regexp .MustCompile (`(?i)<(/?\w+/\w+|/[\w ]+/|/?(html|head|script|style\b) )` )
89
+ // cleans: "<foo/bar", "<any words/", ("<html", "<head", "<script", "<style", "<?", "<%" )
90
+ v .tagCleaner = regexp .MustCompile (`(?i)<(/?\w+/\w+|/[\w ]+/|/?(html|head|script|style|%|\?)\b )` )
91
91
v .nulCleaner = strings .NewReplacer ("\000 " , "" )
92
92
return v
93
93
})
@@ -253,7 +253,7 @@ func postProcess(ctx *RenderContext, procs []processor, input io.Reader, output
253
253
node , err := html .Parse (io .MultiReader (
254
254
// prepend "<html><body>"
255
255
strings .NewReader ("<html><body>" ),
256
- // Strip out nuls - they're always invalid
256
+ // strip out NULLs ( they're always invalid), and escape known tags
257
257
bytes .NewReader (globalVars ().tagCleaner .ReplaceAll ([]byte (globalVars ().nulCleaner .Replace (string (rawHTML ))), []byte ("<$1" ))),
258
258
// close the tags
259
259
strings .NewReader ("</body></html>" ),
0 commit comments