mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 01:05:14 +00:00
Checklist-rendering implemented
This commit is contained in:
parent
fc4a4d38d1
commit
8e09e03127
|
@ -142,6 +142,16 @@ func (r *CustomRender) AutoLink(out *bytes.Buffer, link []byte, kind int) {
|
|||
r.Renderer.AutoLink(out, link, kind)
|
||||
}
|
||||
|
||||
func (options *CustomRender) ListItem(out *bytes.Buffer, text []byte, flags int) {
|
||||
switch {
|
||||
case bytes.HasPrefix(text, []byte("[ ] ")):
|
||||
text = append([]byte(`<input type="checkbox" disabled="" />`), text[3:]...)
|
||||
case bytes.HasPrefix(text, []byte("[x] ")):
|
||||
text = append([]byte(`<input type="checkbox" disabled="" checked="" />`), text[3:]...)
|
||||
}
|
||||
options.Renderer.ListItem(out, text, flags)
|
||||
}
|
||||
|
||||
var (
|
||||
svgSuffix = []byte(".svg")
|
||||
svgSuffixWithMark = []byte(".svg?")
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code")
|
||||
var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code").AllowElements("input").AllowAttrs("type", "checked", "disabled").OnElements("input")
|
||||
|
||||
// EncodeMD5 encodes string to md5 hex value.
|
||||
func EncodeMD5(str string) string {
|
||||
|
|
Loading…
Reference in a new issue