summaryrefslogtreecommitdiffstats
path: root/modules/markup/markdown
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-12-13 02:05:50 +0100
committerGitHub <noreply@github.com>2020-12-13 09:05:50 +0800
commit41e8b834afbd0c98a8ab4549a90a6bce0ec7096f (patch)
tree67e3a2de682b8884af5befeaa47b1924aa83fbd3 /modules/markup/markdown
parent287b594803105ba517680aa50be478648d434035 (diff)
downloadgitea-41e8b834afbd0c98a8ab4549a90a6bce0ec7096f.tar.gz
gitea-41e8b834afbd0c98a8ab4549a90a6bce0ec7096f.zip
Markdown task list improvements (#13952)
* Markdown task list improvements - Remove `.ui` class and wrappers to prevent fomantic from messing with it. - Change rendered HTML to match GitHub. - Add custom styling for the checkboxes. * fix unittest Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/markup/markdown')
-rw-r--r--modules/markup/markdown/goldmark.go6
-rw-r--r--modules/markup/markdown/markdown_test.go6
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go
index 9447424644..f9fd6eb976 100644
--- a/modules/markup/markdown/goldmark.go
+++ b/modules/markup/markdown/goldmark.go
@@ -357,9 +357,9 @@ func (r *HTMLRenderer) renderTaskCheckBoxListItem(w util.BufWriter, source []byt
}
var err error
if n.IsChecked {
- _, err = w.WriteString(`<span class="ui checked checkbox"><input type="checkbox" checked="" readonly="readonly"` + end + `<label>`)
+ _, err = w.WriteString(`<input type="checkbox" disabled="" checked=""` + end)
} else {
- _, err = w.WriteString(`<span class="ui checkbox"><input type="checkbox" readonly="readonly"` + end + `<label>`)
+ _, err = w.WriteString(`<input type="checkbox" disabled=""` + end)
}
if err != nil {
return ast.WalkStop, err
@@ -371,7 +371,7 @@ func (r *HTMLRenderer) renderTaskCheckBoxListItem(w util.BufWriter, source []byt
}
}
} else {
- _, _ = w.WriteString("</label></span></li>\n")
+ _, _ = w.WriteString("</li>\n")
}
return ast.WalkContinue, nil
}
diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go
index 7f27a43a7d..89005fc25d 100644
--- a/modules/markup/markdown/markdown_test.go
+++ b/modules/markup/markdown/markdown_test.go
@@ -142,9 +142,9 @@ func testAnswers(baseURLContent, baseURLImages string) []string {
<p>(from <a href="https://www.markdownguide.org/extended-syntax/" rel="nofollow">https://www.markdownguide.org/extended-syntax/</a>)</p>
<h3 id="user-content-checkboxes">Checkboxes</h3>
<ul>
-<li class="task-list-item"><span class="ui checkbox"><input type="checkbox" readonly="readonly"/><label>unchecked</label></span></li>
-<li class="task-list-item"><span class="ui checked checkbox"><input type="checkbox" checked="" readonly="readonly"/><label>checked</label></span></li>
-<li class="task-list-item"><span class="ui checkbox"><input type="checkbox" readonly="readonly"/><label>still unchecked</label></span></li>
+<li class="task-list-item"><input type="checkbox" disabled=""/>unchecked</li>
+<li class="task-list-item"><input type="checkbox" disabled="" checked=""/>checked</li>
+<li class="task-list-item"><input type="checkbox" disabled=""/>still unchecked</li>
</ul>
<h3 id="user-content-definition-list">Definition list</h3>
<dl>