@@ -86,8 +86,8 @@ var globalVars = sync.OnceValue(func() *globalVarsType {
8686 // codePreviewPattern matches "http://domain/.../{owner}/{repo}/src/commit/{commit}/{filepath}#L10-L20"
8787 v .codePreviewPattern = regexp .MustCompile (`https?://\S+/([^\s/]+)/([^\s/]+)/src/commit/([0-9a-f]{7,64})(/\S+)#(L\d+(-L\d+)?)` )
8888
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 )` )
9191 v .nulCleaner = strings .NewReplacer ("\000 " , "" )
9292 return v
9393})
@@ -253,7 +253,7 @@ func postProcess(ctx *RenderContext, procs []processor, input io.Reader, output
253253 node , err := html .Parse (io .MultiReader (
254254 // prepend "<html><body>"
255255 strings .NewReader ("<html><body>" ),
256- // Strip out nuls - they're always invalid
256+ // strip out NULLs ( they're always invalid), and escape known tags
257257 bytes .NewReader (globalVars ().tagCleaner .ReplaceAll ([]byte (globalVars ().nulCleaner .Replace (string (rawHTML ))), []byte ("<$1" ))),
258258 // close the tags
259259 strings .NewReader ("</body></html>" ),
0 commit comments