From f036de5a9470f82be11b24e30548316f2f251602 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 22 Mar 2020 22:25:38 +0000 Subject: [PATCH] Completely fix task-list checkbox styling (#10798) Continuing on from #10668 this PR makes goldmark apply the task-list styling to task-lists. --- modules/markup/markdown/goldmark.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index a9475b58c..5b16fa8e8 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -82,6 +82,12 @@ func (g *GiteaASTTransformer) Transform(node *ast.Document, reader text.Reader, link = []byte("#user-content-" + string(link)[1:]) } v.Destination = link + case *ast.List: + if v.HasChildren() && v.FirstChild().HasChildren() && v.FirstChild().FirstChild().HasChildren() { + if _, ok := v.FirstChild().FirstChild().FirstChild().(*east.TaskCheckBox); ok { + v.SetAttributeString("class", "task-list") + } + } } return ast.WalkContinue, nil })