diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index b2cf529964091..f44c0acb96131 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -93,6 +93,12 @@ func TestRender_Images(t *testing.T) { test( "[!["+title+"]("+url+")]("+href+")", `

`+title+`

`) + test( + "!["+title+"]("+url+" \"1 -> 2 -> 3 -> 4 -> 5\")", + `

`+title+`

`) + test( + "!["+title+"]("+url+" \"this?is#a!test:P\")", + `

`+title+`

`) } func testAnswers(baseURLContent, baseURLImages string) []string { diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 49f681f05a1e6..00e7ccfc717f5 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -56,6 +56,9 @@ func ReplaceSanitizer() { // Allow classes for anchors sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`ref-issue`)).OnElements("a") + // Allow more characters in title attribute per commonmark spec + sanitizer.policy.AllowAttrs("title").Matching(regexp.MustCompile(`(.*?)`)).OnElements("a") + // Custom keyword markup for _, rule := range setting.ExternalSanitizerRules { if rule.Regexp != nil {