...

Source file src/github.com/yuin/goldmark/extension/ast/tasklist.go

Documentation: github.com/yuin/goldmark/extension/ast

     1  package ast
     2  
     3  import (
     4  	"fmt"
     5  	gast "github.com/yuin/goldmark/ast"
     6  )
     7  
     8  // A TaskCheckBox struct represents a checkbox of a task list.
     9  type TaskCheckBox struct {
    10  	gast.BaseInline
    11  	IsChecked bool
    12  }
    13  
    14  // Dump implements Node.Dump.
    15  func (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.
    23  var KindTaskCheckBox = gast.NewNodeKind("TaskCheckBox")
    24  
    25  // Kind implements Node.Kind.
    26  func (n *TaskCheckBox) Kind() gast.NodeKind {
    27  	return KindTaskCheckBox
    28  }
    29  
    30  // NewTaskCheckBox returns a new TaskCheckBox node.
    31  func NewTaskCheckBox(checked bool) *TaskCheckBox {
    32  	return &TaskCheckBox{
    33  		IsChecked: checked,
    34  	}
    35  }
    36  

View as plain text