Skip to content

Commit 133dfe7

Browse files
committed
fix html in markdown
1 parent 01f2996 commit 133dfe7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/markup/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var globalVars = sync.OnceValue(func() *globalVarsType {
8787
v.codePreviewPattern = regexp.MustCompile(`https?://\S+/([^\s/]+)/([^\s/]+)/src/commit/([0-9a-f]{7,64})(/\S+)#(L\d+(-L\d+)?)`)
8888

8989
// cleans: "<foo/bar", "<any words/", ("<html", "<head", "<script", "<style")
90-
v.tagCleaner = regexp.MustCompile(`(?i)<(/?\w+/\w+|/[\w ]+/|/?(html|head|script|style\b))`)
90+
v.tagCleaner = regexp.MustCompile(`(?i)<(/?\w+/\w+|/[\w ]+/|/?(html|head|script|style|%|\?)\b)`)
9191
v.nulCleaner = strings.NewReplacer("\000", "")
9292
return v
9393
})

modules/markup/html_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ func TestPostProcess(t *testing.T) {
525525
test("<script>a</script>", `&lt;script&gt;a&lt;/script&gt;`)
526526
test("<STYLE>a", `&lt;STYLE&gt;a`)
527527
test("<style>a</STYLE>", `&lt;style&gt;a&lt;/STYLE&gt;`)
528+
529+
// other special tags, our special behavior
530+
test("<?php\nfoo", "&lt;?php\nfoo")
531+
test("<%asp\nfoo", "&lt;%asp\nfoo")
528532
}
529533

530534
func TestIssue16020(t *testing.T) {

0 commit comments

Comments
 (0)