Browse Source

Fix task-list checkbox styling (#10668)

* Fix task-list checkbox styling

The pandoc renderer will append the class "task-list" to the ul element
wrapping a li with one or more check-boxes. This allows us to select for
them, removing their list-style-type property. However, goldmark and the
gfm spec doesn't specify the "task-list" class name, so we can't use
that to fix the issue there.

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>

* Update to goldmark v1.1.25

This version adds the missing space after a checkbox.

Resolves: #9656

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>

Co-authored-by: zeripath <art27@cantab.net>
tags/v1.12.0-dev
Alexander Scheel 4 years ago
parent
commit
b8551f8532
No account linked to committer's email address

+ 1
- 1
go.mod View File

github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141 github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141
github.com/urfave/cli v1.20.0 github.com/urfave/cli v1.20.0
github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 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 go.etcd.io/bbolt v1.3.3 // indirect
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa

+ 1
- 0
go.sum View File

github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53/go.mod h1:f6elajwZV+xceiaqgRL090YzLEDGSbqr3poGL3ZgXYo= 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 h1:K4FemPDr4x/ZcqldoXWnexTLfdMIy2eEfXxsLnotTRI=
github.com/yuin/goldmark v1.1.24/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 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 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= 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= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=

+ 3
- 0
modules/markup/sanitizer.go View File

// Allow classes for anchors // Allow classes for anchors
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`ref-issue`)).OnElements("a") 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 // Allow generally safe attributes
generalSafeAttrs := []string{"abbr", "accept", "accept-charset", generalSafeAttrs := []string{"abbr", "accept", "accept-charset",
"accesskey", "action", "align", "alt", "accesskey", "action", "align", "alt",

+ 2
- 2
vendor/github.com/yuin/goldmark/extension/tasklist.go View File

w.WriteString(`<input disabled="" type="checkbox"`) w.WriteString(`<input disabled="" type="checkbox"`)
} }
if r.XHTML { if r.XHTML {
w.WriteString(" />")
w.WriteString(" /> ")
} else { } else {
w.WriteString(">")
w.WriteString("> ")
} }
return gast.WalkContinue, nil return gast.WalkContinue, nil
} }

+ 15
- 14
vendor/github.com/yuin/goldmark/parser/list.go View File

} }
return Continue | HasChildren 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. // "offset" means a width that bar indicates.
// - aaaaaaaa // - aaaaaaaa
if !list.CanContinue(marker, typ == orderedList) { if !list.CanContinue(marker, typ == orderedList) {
return Close 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 return Continue | HasChildren
} }
} }

+ 1
- 1
vendor/modules.txt View File

github.com/xanzy/ssh-agent github.com/xanzy/ssh-agent
# github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 # github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53
github.com/yohcop/openid-go 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
github.com/yuin/goldmark/ast github.com/yuin/goldmark/ast
github.com/yuin/goldmark/extension github.com/yuin/goldmark/extension

+ 5
- 0
web_src/less/_markdown.less View File

list-style-type: none; list-style-type: none;
} }


ul.task-list,
ol.task-list {
list-style-type: none;
}

ul ul, ul ul,
ul ol, ul ol,
ol ol, ol ol,

Loading…
Cancel
Save