internal/adapters/markdown
import "github.com/nilstate/scafld/v2/internal/adapters/markdown"
Package markdown parses, renders, and stores living Markdown task specs.
Variables
Source: internal/adapters/markdown/spec_store.go:18
var (
// ErrSpecNotFound is returned when taskID cannot be found in spec directories.
ErrSpecNotFound = errors.New("spec not found")
// ErrSpecExists is returned when a write would overwrite another task spec.
ErrSpecExists = errors.New("spec already exists")
// ErrMalformedMarkdown wraps spec Markdown grammar failures.
ErrMalformedMarkdown = errors.New("malformed markdown spec")
)Functions
func Parse(data []byte) (spec.Model, error)
Source: internal/adapters/markdown/parser.go:24
Parse converts living Markdown spec bytes into a normalized model.
func Render(model spec.Model) []byte
Source: internal/adapters/markdown/renderer.go:14
Render converts a normalized model into canonical living Markdown.
Types
type Store
Source: internal/adapters/markdown/spec_store.go:26
Store reads and writes Markdown task specs under a workspace root.
type Store struct {
Root string
}Fields
Root string
func CreateDraft(ctx context.Context, model spec.Model) (string, error)
Source: internal/adapters/markdown/spec_store.go:38
CreateDraft writes model as a new draft spec and returns its path.
func Find(taskID string) (string, error)
Source: internal/adapters/markdown/spec_store.go:92
Find returns the path for taskID across active spec directories.
func List(ctx context.Context) ([]spec.Record, error)
Source: internal/adapters/markdown/spec_store.go:122
List returns summaries for current non-archived task specs.
func ListAll(ctx context.Context) ([]spec.Record, error)
Source: internal/adapters/markdown/spec_store.go:127
ListAll returns summaries for current and archived task specs.
func Load(ctx context.Context, taskID string) (spec.Model, string, error)
Source: internal/adapters/markdown/spec_store.go:56
Load finds, parses, and returns a spec by task ID. If the file's directory disagrees with its frontmatter status, Load relocates it to the status-implied directory before returning. Relocation failures are non-fatal.
func LoadSource(ctx context.Context, taskID string) (spec.Source, error)
Source: internal/adapters/markdown/spec_store.go:67
LoadSource finds, parses, and returns a spec together with the exact Markdown bytes read from disk. If the file's directory disagrees with frontmatter status, LoadSource relocates it before returning the target path.
func Save(ctx context.Context, path string, model spec.Model) error
Source: internal/adapters/markdown/spec_store.go:49
Save writes model to an existing spec path.
