task

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package task provides task item parsing and matching.

This package handles the domain logic for task items, independent of their Markdown representation.

Index

Constants

View Source
const (
	MatchFull    = iota // Full match
	MatchIndent         // Leading whitespace
	MatchState          // "x" or " " or ""
	MatchContent        // Task text
)

Match indices for accessing capture groups.

Usage:

match := task.ItemPattern.FindStringSubmatch(line)
if match != nil {
    indent := match[task.MatchIndent]
    state := match[task.MatchState]
    content := match[task.MatchContent]
}

Variables

This section is empty.

Functions

func Completed

func Completed(match []string) bool

Completed reports whether a match represents a completed task.

Parameters:

  • match: Result from ItemPattern.FindStringSubmatch

Returns:

  • bool: True if the checkbox is checked ([x])

func Content

func Content(match []string) string

Content returns the task text from a match.

Parameters:

  • match: Result from ItemPattern.FindStringSubmatch

Returns:

  • string: Task content (empty if the match is invalid)

func Indent

func Indent(match []string) string

Indent returns the leading whitespace from a match.

Parameters:

  • match: Result from ItemPattern.FindStringSubmatch

Returns:

  • string: Indent string (may be empty for top-level tasks)

func IsPending

func IsPending(match []string) bool

IsPending reports whether a match represents a pending task.

Parameters:

  • match: Result from ItemPattern.FindStringSubmatch

Returns:

  • bool: True if the checkbox is unchecked ([ ])

func IsSubTask

func IsSubTask(match []string) bool

IsSubTask reports whether a match represents a subtask (indented).

Parameters:

  • match: Result from ItemPattern.FindStringSubmatch

Returns:

  • bool: True if indent is 2+ spaces

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL