1package ast
2
3import (
4 "fmt"
5 gast "github.com/yuin/goldmark/ast"
6)
7
8// A TaskCheckBox struct represents a checkbox of a task list.
9type TaskCheckBox struct {
10 gast.BaseInline
11 IsChecked bool
12}
13
14// Dump implements Node.Dump.
15func (n *TaskCheckBox) Dump(source []byte, level int) {
16 m := map[string]string{
17 "Checked": fmt.Sprintf("%v", n.IsChecked),
18 }
19 gast.DumpHelper(n, source, level, m, nil)
20}
21
22// KindTaskCheckBox is a NodeKind of the TaskCheckBox node.
23var KindTaskCheckBox = gast.NewNodeKind("TaskCheckBox")
24
25// Kind implements Node.Kind.
26func (n *TaskCheckBox) Kind() gast.NodeKind {
27 return KindTaskCheckBox
28}
29
30// NewTaskCheckBox returns a new TaskCheckBox node.
31func NewTaskCheckBox(checked bool) *TaskCheckBox {
32 return &TaskCheckBox{
33 IsChecked: checked,
34 }
35}