util

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDate added in v0.5.0

func ParseDate(input string, dateFormat string) (time.Time, error)

ParseDate parses flexible date inputs for daily notes. Supports: "today", "yesterday", "tomorrow", "+N", "-N", ISO date format.

func ParseDueDate

func ParseDueDate(s string) (time.Time, error)

ParseDueDate parses flexible date formats for task due dates. Supports:

  • "today", "tomorrow", "tom"
  • "+N" (N days from today)
  • "2006-01-02" (ISO format)
  • "01-02", "01/02", "1/2" (current year)

func ParseDueDateSimple

func ParseDueDateSimple(s string) time.Time

ParseDueDateSimple parses date without returning an error (returns zero time on failure). Used in TUI where we don't need detailed error messages.

func RenderMarkdown added in v0.6.0

func RenderMarkdown(content string, width int, style string) (string, error)

RenderMarkdown renders markdown content with ANSI styling for terminal output. Falls back to raw content on error.

func TruncateString

func TruncateString(s string, maxWidth int) string

TruncateString truncates a string to fit within maxWidth, adding "..." suffix if truncated. Properly handles wide characters.

func WrapByWidth

func WrapByWidth(s string, maxWidth int) []string

WrapByWidth wraps a string into multiple lines based on display width. Properly handles wide characters (CJK).

Types

type Styles

type Styles struct {
	Title          lipgloss.Style
	Selected       lipgloss.Style
	Normal         lipgloss.Style
	Done           lipgloss.Style
	Meta           lipgloss.Style
	Help           lipgloss.Style
	Empty          lipgloss.Style
	PriorityHigh   lipgloss.Style
	PriorityMedium lipgloss.Style
	PriorityLow    lipgloss.Style
	DoneSection    lipgloss.Style
}

Styles holds common TUI styles.

func NewStyles

func NewStyles(cfg *config.Config) Styles

NewStyles creates TUI styles from config.

Jump to

Keyboard shortcuts

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