aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/markdown/ast.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/markdown/ast.go')
-rw-r--r--modules/markup/markdown/ast.go41
1 files changed, 40 insertions, 1 deletions
diff --git a/modules/markup/markdown/ast.go b/modules/markup/markdown/ast.go
index f79d12435b..d735ff5ebd 100644
--- a/modules/markup/markdown/ast.go
+++ b/modules/markup/markdown/ast.go
@@ -4,7 +4,11 @@
package markdown
-import "github.com/yuin/goldmark/ast"
+import (
+ "strconv"
+
+ "github.com/yuin/goldmark/ast"
+)
// Details is a block that contains Summary and details
type Details struct {
@@ -70,6 +74,41 @@ func IsSummary(node ast.Node) bool {
return ok
}
+// TaskCheckBoxListItem is a block that repressents a list item of a markdown block with a checkbox
+type TaskCheckBoxListItem struct {
+ *ast.ListItem
+ IsChecked bool
+}
+
+// KindTaskCheckBoxListItem is the NodeKind for TaskCheckBoxListItem
+var KindTaskCheckBoxListItem = ast.NewNodeKind("TaskCheckBoxListItem")
+
+// Dump implements Node.Dump .
+func (n *TaskCheckBoxListItem) Dump(source []byte, level int) {
+ m := map[string]string{}
+ m["IsChecked"] = strconv.FormatBool(n.IsChecked)
+ ast.DumpHelper(n, source, level, m, nil)
+}
+
+// Kind implements Node.Kind.
+func (n *TaskCheckBoxListItem) Kind() ast.NodeKind {
+ return KindTaskCheckBoxListItem
+}
+
+// NewTaskCheckBoxListItem returns a new TaskCheckBoxListItem node.
+func NewTaskCheckBoxListItem(listItem *ast.ListItem) *TaskCheckBoxListItem {
+ return &TaskCheckBoxListItem{
+ ListItem: listItem,
+ }
+}
+
+// IsTaskCheckBoxListItem returns true if the given node implements the TaskCheckBoxListItem interface,
+// otherwise false.
+func IsTaskCheckBoxListItem(node ast.Node) bool {
+ _, ok := node.(*TaskCheckBoxListItem)
+ return ok
+}
+
// Icon is an inline for a fomantic icon
type Icon struct {
ast.BaseInline