mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 17:18:59 +00:00
Merge pull request #1609 from denghongcai/develop
Add allow attribute `class` to `<code>` tag
This commit is contained in:
commit
c3061c61a7
|
@ -15,6 +15,7 @@ import (
|
|||
"hash"
|
||||
"html/template"
|
||||
"math"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -26,7 +27,8 @@ import (
|
|||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var Sanitizer = bluemonday.UGCPolicy()
|
||||
var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code")
|
||||
|
||||
|
||||
// Encode string to md5 hex value.
|
||||
func EncodeMd5(str string) string {
|
||||
|
|
Loading…
Reference in a new issue