diff --git a/modules/markup/html.go b/modules/markup/html.go index 05701eebde..0e074cbcfa 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -85,7 +85,8 @@ var globalVars = sync.OnceValue(func() *globalVarsType { // codePreviewPattern matches "http://domain/.../{owner}/{repo}/src/commit/{commit}/{filepath}#L10-L20" v.codePreviewPattern = regexp.MustCompile(`https?://\S+/([^\s/]+)/([^\s/]+)/src/commit/([0-9a-f]{7,64})(/\S+)#(L\d+(-L\d+)?)`) - v.tagCleaner = regexp.MustCompile(`<((?:/?\w+/\w+)|(?:/[\w ]+/)|(/?[hH][tT][mM][lL]\b)|(/?[hH][eE][aA][dD]\b))`) + // cleans: "go-gitea/gitea#12345`) - // Test that other post processing still works. + // Test that other post-processing still works. test( ":gitea:", `:gitea:`) @@ -499,6 +499,12 @@ func TestPostProcess_RenderDocument(t *testing.T) { `Some text with 😄 in the middle`) test("http://localhost:3000/person/repo/issues/4#issuecomment-1234", `person/repo#4 (comment)`) + + // special tags, GitHub's behavior, and for unclosed tags, output as text content as much as possible + test("", `<script>a</script>`) + test("", `<style>a</STYLE>`) } func TestIssue16020(t *testing.T) {