parser

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package parser reads markdown task files with YAML frontmatter.

It extracts structured model.Task values from .md files, deriving task IDs and titles from filenames when not specified in frontmatter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasTaskSignature added in v0.4.7

func HasTaskSignature(frontmatter []byte) bool

HasTaskSignature reports whether raw frontmatter text looks like it was intended to be taskmd frontmatter, based on the presence of task-signature keys (id, status, priority, dependencies).

This is a behavioral contract for error reporting: a file whose frontmatter is present but not valid YAML is reported as a broken task file only when it carries at least one of these keys. Foreign markdown with frontmatter (docs pages, blog posts) that lacks them is silently skipped, as before.

func ParseTaskContent

func ParseTaskContent(filePath string, content []byte) (*model.Task, error)

ParseTaskContent parses task content from bytes

func ParseTaskFile

func ParseTaskFile(filePath string) (*model.Task, error)

ParseTaskFile reads and parses a markdown file with YAML frontmatter

Types

type ParseError

type ParseError struct {
	FilePath string
	Message  string
	Err      error
	// Frontmatter holds the raw frontmatter text when the error came from a
	// frontmatter block that was present but could not be parsed. It is nil
	// for other errors (missing file, no frontmatter, missing fields).
	Frontmatter []byte
}

ParseError represents an error during parsing

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) MalformedTaskFrontmatter added in v0.4.7

func (e *ParseError) MalformedTaskFrontmatter() bool

MalformedTaskFrontmatter reports whether this error came from a file whose frontmatter was present but invalid, and whose raw text carries task-signature keys (see HasTaskSignature). Scanners use it to distinguish a broken task file, which must be reported, from foreign markdown, which is silently skipped.

Jump to

Keyboard shortcuts

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