diff --git a/go.mod b/go.mod index 683ae18cb..2f581f1e0 100644 --- a/go.mod +++ b/go.mod @@ -96,7 +96,7 @@ require ( github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141 github.com/urfave/cli v1.20.0 github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 - github.com/yuin/goldmark v1.1.24 + github.com/yuin/goldmark v1.1.25 go.etcd.io/bbolt v1.3.3 // indirect golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa diff --git a/go.sum b/go.sum index 7522fd9c8..1b75c6a71 100644 --- a/go.sum +++ b/go.sum @@ -576,6 +576,7 @@ github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 h1:HsIQ6yAjfjQ3Ix github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53/go.mod h1:f6elajwZV+xceiaqgRL090YzLEDGSbqr3poGL3ZgXYo= github.com/yuin/goldmark v1.1.24 h1:K4FemPDr4x/ZcqldoXWnexTLfdMIy2eEfXxsLnotTRI= github.com/yuin/goldmark v1.1.24/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index ee9944723..b5c6dc25f 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -53,6 +53,9 @@ func ReplaceSanitizer() { // Allow classes for anchors sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`ref-issue`)).OnElements("a") + // Allow classes for task lists + sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list`)).OnElements("ul") + // Allow generally safe attributes generalSafeAttrs := []string{"abbr", "accept", "accept-charset", "accesskey", "action", "align", "alt", diff --git a/vendor/github.com/yuin/goldmark/extension/tasklist.go b/vendor/github.com/yuin/goldmark/extension/tasklist.go index 825f8d522..1f3e52c20 100644 --- a/vendor/github.com/yuin/goldmark/extension/tasklist.go +++ b/vendor/github.com/yuin/goldmark/extension/tasklist.go @@ -92,9 +92,9 @@ func (r *TaskCheckBoxHTMLRenderer) renderTaskCheckBox(w util.BufWriter, source [ w.WriteString(`") + w.WriteString(" /> ") } else { - w.WriteString(">") + w.WriteString("> ") } return gast.WalkContinue, nil } diff --git a/vendor/github.com/yuin/goldmark/parser/list.go b/vendor/github.com/yuin/goldmark/parser/list.go index b1d53bd68..df1607ea0 100644 --- a/vendor/github.com/yuin/goldmark/parser/list.go +++ b/vendor/github.com/yuin/goldmark/parser/list.go @@ -166,20 +166,6 @@ func (b *listParser) Continue(node ast.Node, reader text.Reader, pc Context) Sta } return Continue | HasChildren } - // Thematic Breaks take precedence over lists - if isThematicBreak(line, reader.LineOffset()) { - isHeading := false - last := pc.LastOpenedBlock().Node - if ast.IsParagraph(last) { - c, ok := matchesSetextHeadingBar(line) - if ok && c == '-' { - isHeading = true - } - } - if !isHeading { - return Close - } - } // "offset" means a width that bar indicates. // - aaaaaaaa @@ -200,6 +186,21 @@ func (b *listParser) Continue(node ast.Node, reader text.Reader, pc Context) Sta if !list.CanContinue(marker, typ == orderedList) { return Close } + // Thematic Breaks take precedence over lists + if isThematicBreak(line[match[3]-1:], 0) { + isHeading := false + last := pc.LastOpenedBlock().Node + if ast.IsParagraph(last) { + c, ok := matchesSetextHeadingBar(line) + if ok && c == '-' { + isHeading = true + } + } + if !isHeading { + return Close + } + } + return Continue | HasChildren } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 28bf533ec..61cc1657c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -452,7 +452,7 @@ github.com/willf/bitset github.com/xanzy/ssh-agent # github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 github.com/yohcop/openid-go -# github.com/yuin/goldmark v1.1.24 +# github.com/yuin/goldmark v1.1.25 github.com/yuin/goldmark github.com/yuin/goldmark/ast github.com/yuin/goldmark/extension diff --git a/web_src/less/_markdown.less b/web_src/less/_markdown.less index cb2ce32c3..78a0d3a15 100644 --- a/web_src/less/_markdown.less +++ b/web_src/less/_markdown.less @@ -192,6 +192,11 @@ list-style-type: none; } + ul.task-list, + ol.task-list { + list-style-type: none; + } + ul ul, ul ol, ol ol,