notes

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDailyNotePath

func BuildDailyNotePath(diaryDir string, date time.Time) string

BuildDailyNotePath builds the path for a daily note.

func BuildDailyNoteSections

func BuildDailyNoteSections(cfg *config.LoadedConfig) []string

BuildDailyNoteSections returns the sections list for a daily note from config.

func CreateDailyNote

func CreateDailyNote(ctx context.Context, notePath string, sections []string, date time.Time) error

CreateDailyNote creates a daily note with template with context support.

func CreateNote

func CreateNote(ctx context.Context, path string, content string) error

CreateNote creates a note file with the given content.

func EnsureDir

func EnsureDir(path string) error

EnsureDir creates a directory if it doesn't exist.

func FindNotes

func FindNotes(ctx context.Context, dir string) ([]string, error)

FindNotes finds all markdown files in a directory recursively with context support.

func GetDailyNotePath

func GetDailyNotePath(date time.Time) (string, error)

GetDailyNotePath returns the path for today's daily note.

func GetEditorCmd

func GetEditorCmd(path string) (*exec.Cmd, error)

GetEditorCmd returns a command to open a file in the editor.

func GetEditorCmdWithContext

func GetEditorCmdWithContext(ctx context.Context, path string) (*exec.Cmd, error)

GetEditorCmdWithContext returns a command to open a file in the editor, with context support.

func GetEditorCmdWithShellFallback

func GetEditorCmdWithShellFallback(ctx context.Context, path string) (*exec.Cmd, error)

func GetNotesByPattern

func GetNotesByPattern(ctx context.Context, pattern string) ([]string, error)

GetNotesByPattern finds notes matching the given glob pattern.

func GetNotesByTag

func GetNotesByTag(ctx context.Context, tag string, limit int) ([]string, error)

func GetRecentDailyNotes

func GetRecentDailyNotes(ctx context.Context, diaryDir string, count int) ([]string, error)

GetRecentDailyNotes gets the most recent daily notes with context support.

func OpenInEditor

func OpenInEditor(path string) error

OpenInEditor opens a file in the user's preferred editor. Note: External edits via this function do not automatically update the search index. Run 'jotr index sync' to sync external modifications.

func OpenInEditorWithContext

func OpenInEditorWithContext(ctx context.Context, path string) error

func UpdateIndex added in v1.3.0

func UpdateIndex(ctx context.Context, path string, content string) error
func UpdateLinks(ctx context.Context) error

func WriteNote

func WriteNote(ctx context.Context, path string, content string) error

WriteNote writes content to a note file with context support.

Types

type Note

type Note struct {
	Date     time.Time
	Metadata map[string]interface{}
	Path     string
	Name     string
	Content  string
}

Note represents a note file.

func ReadNote

func ReadNote(ctx context.Context, path string) (*Note, error)

ReadNote reads a note file with context support for cancellation.

type SearchMatch added in v1.3.0

type SearchMatch struct {
	Path    string
	Content []byte
}

SearchMatch represents a file that matched a search query, including its content.

func SearchNotes

func SearchNotes(ctx context.Context, dir string, query string, limit int) ([]SearchMatch, error)

Jump to

Keyboard shortcuts

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