aboutsummaryrefslogtreecommitdiff
path: root/modules/base/markdown.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-01-25 13:56:13 -0500
committerUnknwon <u@gogs.io>2016-01-25 13:56:13 -0500
commit71b9537393e3b1a377e63b00046031d53c0681d5 (patch)
tree6ed4c155305bcf29d60ee3e3f3a22a00cf97a58d /modules/base/markdown.go
parentb33abc62805611f37fc92a3e75ece326efaabaf2 (diff)
parenta1a4f1103caa42f090314c77c695f4e34781da64 (diff)
Merge pull request #2396 from bkcsoft/feature/markdown-checklist
[Feature] Markdown Checklist-rendering
Diffstat (limited to 'modules/base/markdown.go')
-rw-r--r--modules/base/markdown.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index a3d3a7ca..0ef379b8 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -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?")